ASP Error: script block cannot be placed inside another

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Greybase
Beginner
Beginner
Posts: 3
Joined: Mon Jul 31, 2006 8:35 am

ASP Error: script block cannot be placed inside another

Post by Greybase »

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??? 8O

TIA
Greybase
Last edited by Greybase on Mon Jul 31, 2006 9:07 am, edited 1 time in total.
Greybase
Beginner
Beginner
Posts: 3
Joined: Mon Jul 31, 2006 8:35 am

CODE causing error:

Post by Greybase »

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: Select all

<!--
if(ns4)_d.write("<script language=JavaScript src=mmenuns4.js><\/script>");
else _d.write("<script language=JavaScript src=mmenudom.js><\/script>");
-->
[/color]

However removing this section, still raises a Javascript Error. The MS Script Debugger highlights this error as:

Code: Select all

{o$(_y,1,_baL)}
Below is the full <head> section of my page.

Code: Select all

<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="https://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> ....
Greybase
Beginner
Beginner
Posts: 3
Joined: Mon Jul 31, 2006 8:35 am

Post by Greybase »

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! :roll:

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: Select all

<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>
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

You said you run .asp pages. Is anything in your _data file using any type of asp calls or functions? If so, change the suffix on the file; i.e., menu_data.asp.
John
Post Reply