Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:58
ASP Error: script block cannot be placed inside another
Poster: Greybase
Dated: Monday July 31 2006 - 8:46:01 BST
Everything was working FINE - I loaded the Menu on a "sample" page, I edited the menu_data.js file, I tweaked the Styles and colors etc. Real nice. So I purchase the Menu.
Then I realized I had tested it on a plain HTML page - my entire website runs on MS Active Server Pages ASP files - parsed on the server with dynamic includes. This should not conflict with Javascript!
There is an ASP Error loading the menu. I have checked and double checked the code. I get --
"script block cannot be placed inside another script block."
I searched on this string here, but apparently this Support Forum won't allow a string search because I got back 3900 results. This MUST be a common error! I did absolutely nothing except paste the startup code, in the <HEAD> section of my ASP file the same as my HTM file I used for testing.
Someone please help - this has to be a simple error???
TIA
Greybase
CODE causing error:
Poster: Greybase
Dated: Monday July 31 2006 - 9:06:04 BST
Below is my code - as you can see there is nothing really fancy. The Error is caused by this code section below. Removing this section allows the page to load, at least -- NO menu visible. I have tested this in TWO different browsers, IE 6.0 and FireFox latest version. Same result.
Code:
<!--
if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>");
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
-->
if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>");
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
-->
However removing this section, still raises a Javascript Error. The MS Script Debugger highlights this error as:
Code:
{o$(_y,1,_baL)}
Below is the full <head> section of my page.
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="TextPad 4.0">
<title>Sample Test Page</title>
<script type="text/javascript" src="milonic_src.js"></script>
<noscript><a href="http://www.milonic.com/">JavaScript Menus and DHTML Menus Powered by Milonic</a></noscript>
<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>
<LINK REL=STYLESHEET TYPE="text/css" HREF="stylesheet.css">
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<%
Dim newschoice
newschoice = Request.Querystring("track")
subchoice = Request.Querystring("subx")
%>
<TABLE class="bkgd" border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr> ....
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="TextPad 4.0">
<title>Sample Test Page</title>
<script type="text/javascript" src="milonic_src.js"></script>
<noscript><a href="http://www.milonic.com/">JavaScript Menus and DHTML Menus Powered by Milonic</a></noscript>
<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>
<LINK REL=STYLESHEET TYPE="text/css" HREF="stylesheet.css">
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<%
Dim newschoice
newschoice = Request.Querystring("track")
subchoice = Request.Querystring("subx")
%>
<TABLE class="bkgd" border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr> ....
Poster: Greybase
Dated: Monday July 31 2006 - 10:13:12 BST
UPDATE:
OK -- I got it working now, by removing the conditional branch to Netscape4.
I can live with this, if the Netscape4 support is really history. I can imagine that's quite likely the case!
Could anyone comment on this code -- What is the difference between <script type= > and <script language= > and should I change anything? Thanks for your response.
Code:
<script type="text/javascript" src="milonic_src.js"></script>
<script language=JavaScript src=mmenudom.js type=text/javascript></script>
<script type="text/javascript" src="menu_data.js"></script>
<script language=JavaScript src=mmenudom.js type=text/javascript></script>
<script type="text/javascript" src="menu_data.js"></script>