problem with asp page

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
v8kmj
Beginner
Beginner
Posts: 1
Joined: Wed Sep 29, 2004 3:27 pm

problem with asp page

Post by v8kmj »

I'm sure it's something I'm doing wrong, but when I drop the code into an ASP page, the menus don't work. They work fine in an HTML page.

Pages are at:

http://www.companyregistrations.co.uk/test.htm

http://www.companyregistrations.co.uk/test.asp

Code below:

ASP Page

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
</head>
<script type="text/javascript" src="milonic_src.js"></script>
<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>
<script type="text/javascript" src="menu_data.js"></script>
<body>

</body>
</html>


HTM Page

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script type="text/javascript" src="milonic_src.js"></script>
<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>
<script type="text/javascript" src="menu_data.js"></script>
<body>

</body>
</html>
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I don't know anything about asp, but you might want to take a look at these posts. I don't know if they will be of help. And, the link for the asp page is not working, it says page not found.

http://milonic.com/forum/viewtopic.php?p=23466
http://milonic.com/forum/viewtopic.php?p=23521

Ruth
EighteenNinetyEight
Beginner
Beginner
Posts: 7
Joined: Sun Oct 03, 2004 12:23 am

Post by EighteenNinetyEight »

Hello,

I really like the features and customization of the Milonic software.

I would love to purchase it. However, I, like at least 1/3 of the web development community use microsoft active server pages.

I am having the same problem as the user who started this thread.

if the exact same code is placed in a file with the extention .asp as opposed to .htm the page cannot be displayed.

Pages:
http://www.gohrsch.com/test.html
http://www.gohrsch.com/test.asp

Code:

<head>
<title>Untitled Document</title>
<script type="text/javascript" src="milonic_src.js"></script>
<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>
<script type="text/javascript" src="menu_data.js"></script>
</head>

Upon further investigation, I can sometimes generate the following error:

Active Server Pages error 'ASP 0138'
Nested Script Block
/test.asp, line 10
A script block cannot be placed inside another script block.

If i remove the offending javascript tag (the second javascript tag), then nothing at all appears on the page.

I really hope Milonic takes this concern seriously and can figure out a solution. I really want to use this navigation system and I'm sure thousands of other ASP develpers would as well.

Thanks,

James
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Did you check the two links to see if they were any help?

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

Post by kevin3442 »

Hi James,
EighteenNinetyEight wrote:...I really hope Milonic takes this concern seriously...
I think I can safely speak for Milonic by saying that they take every concern of every customer or potential customer seriously. I think you'll find the support they offer hard to beat in any comparable product (keeping in mind that I am clearly biased ;) )
EighteenNinetyEight wrote:...if the exact same code is placed in a file with the extention .asp as opposed to .htm the page cannot be displayed...

Active Server Pages error 'ASP 0138'
Nested Script Block
/test.asp, line 10
A script block cannot be placed inside another script block
Thanks for posting the error message. That helped a lot. I don't know about the line number (10), but the only nested script blocks occur in the lines that test whether the browser is ns4 or not, to determine whether to load mmenuns4.js or mmenudom.js. I would therefore suggest changing the following lines:

Code: Select all

if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>"); 
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
to this:

Code: Select all

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>");
I tested this, making the substitution in the test code you posted and, as you can see here, it works.

The full index.asp code I used to test:

Code: Select all

<head>
<title>Untitled Document</title>
<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>
</head>
Breaking "script" into two separate strings in the document.write() output seems to do the trick to get around the nested <script> block problem. You'll notice that this is how the menu scripts are loaded in the downloadable samples from the main site... I'm guessing that this might be one of the reasons why. I did, however, notice that the sample code given in the install.txt file that comes with the downloads is the same script that you and v8kmj used; it does not break "script" up. I'm thinking that the install.txt file should be updated.

I hope this solves the problem for both you and v8kmj. And I hope you decide to purchase a license; you won't regret it.

Cheers,

Kevin
EighteenNinetyEight
Beginner
Beginner
Posts: 7
Joined: Sun Oct 03, 2004 12:23 am

YAY!!!

Post by EighteenNinetyEight »

Thanks! You saved the day!!!

(And very promptly)

I've really liked Milonic ever since that hilarious incedent with Orin Hatch!

James
EighteenNinetyEight
Beginner
Beginner
Posts: 7
Joined: Sun Oct 03, 2004 12:23 am

Not working in Netscape 4

Post by EighteenNinetyEight »

Hey so, this menu is completely blank when loading in netscape 4...
http://www.gohrsch.com/test2.asp

Code:

Code: Select all

<html>
<head>
<title>Untitled Document</title>
<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> 

</head>

<body>
Hello
</body>
</html>

The link to the file seems right. But I tried loading the milonic home page in my version of netscape 4 and it does work.

What might I be doing wrong.[/url]
EighteenNinetyEight
Beginner
Beginner
Posts: 7
Joined: Sun Oct 03, 2004 12:23 am

Problem with Netscape 4 solved

Post by EighteenNinetyEight »

Ok, I figured out the netscape problem I was having by comparing my code with the code on the milonic home page.

Apparently, the comment tags were preventing Netscape 4 from displaying the menu.

Here's the working code:

Code: Select all

<html>
<head>
<title>Untitled Document</title>
<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> 

</head>

<body>
Hello
</body>
</html>
Thanks again everyone!

James
Post Reply