Embedding the dhtml code inside a table cell

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
naveedarif
Beginner
Beginner
Posts: 3
Joined: Wed Nov 03, 2004 7:21 pm

Embedding the dhtml code inside a table cell

Post by naveedarif »

I am having difficulty embedding the dhtml menu inside a cell (<td>) which is inside another cell. The following page which has the menu, needs to be called as an include from the main page.

Here is the url:
http://www.cair-net.org/includes/topnav ... mlexpt.asp


Also, the following code always break the website by giving the following error:

<script type="text/javascript">
if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>");
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
</script>


Error Type:
Active Server Pages, ASP 0138 (0x80004005)
A script block cannot be placed inside another script block.
/includes/topnavigation.asp, line 4

Please help.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Embedding the dhtml code inside a table cell

Post by kevin3442 »

Hi,
naveedarif wrote:I am having difficulty embedding the dhtml menu inside a cell (<td>) which is inside another cell. The following page which has the menu, needs to be called as an include from the main page.
I'm a little unclear as to what kind of difficulty you're having. Can you be more specific please? What isn't working?
Also, the following code always break the website by giving the following error:

<script type="text/javascript">
if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>");
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
</script>

Error Type:
Active Server Pages, ASP 0138 (0x80004005)
A script block cannot be placed inside another script block.
/includes/topnavigation.asp, line 4
See this post for a solution.

You should also update your menu code. You are using v5.04, but v5.51 is the current release. There have been many fixes and enhancements since v5.04.

Hope that helps,

Kevin
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Is it because you are not hiding the script such as

<!--
-->

I don't see body tags on your example, if its xhtml you might need to use CDATA, should be an example in begginers section. To be sure you could validate the html and see what occurs.

However, I realize that includes can be tricky depending up your set up.

Maybe you need to include scripts directly, like include=script path. I've had includes that wouldn't work unless I wrote them as @include=

This may be a bit out of my scope.

maz
naveedarif
Beginner
Beginner
Posts: 3
Joined: Wed Nov 03, 2004 7:21 pm

Thanks...However, still searching for the answer...

Post by naveedarif »

Hi, thanks for your responses.
If I use the following code (with all the commenting etc), the menu does not appear in any web browswer:

<script type="text/javascript">
<!--
if(ns4)_d.write("<SCR"+"IPT LANGUAGE=JavaScript SRC=mmenuns4.js><\/SCR"+"IPT>");
else _d.write("<SCR"+"IPT LANGUAGE=JavaScript SRC=mmenudom.js><\/SCR"+"IPT>");
-->

Also, this 'topnavigation.asp' file really is just an include file to be called from the main page. That is why there are no body tags in this asp file. Why I put the references for the .js files in this one was in order to atleast test it since putting these references in the <head> or <body> tags in the main page and then calling include file was not working either.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Here is a working example using the same code to load the menu scripts in an .asp page. The exact code used to load the menu scripts on that page is:

Code: Select all

<script type="text/javascript" src="milonic_src.js"></script> 
<script   type="text/javascript"> 
<!-- 
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>"); 
  else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>"); 
 --> 
</script> 
<script type="text/javascript" src="menu_data.js"></script>
This works for me. The only thing I might suggest is removing the comment tags, although I don't know why that would be a problem.

What browsers are you trying your page in? Can you post the .asp code for your test page (put it inside of BBCode "code" tags)?

Kevin
Post Reply