ns4 is undefined Error

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Cin Coder
Beginner
Beginner
Posts: 2
Joined: Wed Dec 22, 2004 5:25 pm

ns4 is undefined Error

Post by Cin Coder »

When I plugin the new menus, the page loads without the menu and the following error is thrown:

ns4 is undefined

Any help with this would be appreciated. This is an intranet page, so I cannot post a link....

Here's a sample of the calls to the menus....


<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../@all/documents/general/style.css">
<meta name="keywords" content="marketing contacts, contacts">
<meta name="description" content="">

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- JS includes to create the navigational drop downs -->
<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>

<!-- Start header table with logo and global nav -->
<table width="772" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" width="164"><img src="../../../@images/documents/general/hdr_logo.gif" width="164" height="65"></td>
<td width="304"><img src="../../../@images/documents/general/hdr_curve.jpg" width="304" height="19"></td>
<td width="304" bgcolor="#17437A"><p><img src="../../../@images/documents/general/nav_dot.gif" width="11" height="10"><a href="../../../@all/documents/general/Default.asp" class="topNav"></a>&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../../@images/documents/general/nav_dot.gif" width="11" height="10"><a href="" class="topNav">Feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../../@images/documents/general/nav_dot.gif" width="11" height="10"><a href="" class="topNav">Contact Us</a></td>
</tr>
<tr>
<td width="304"><img src="../../../@images/documents/general/hdr_welcome.jpg" width="304" height="46"></td>
<td width="304"><img src="../../../@images/documents/general/hdr_img.jpg" width="304" height="46"></td>
</tr>
<!-- Empty row to allow space for js generated DHTML menu -->
<tr>
<td width="164"><script type="text/javascript" src="menu_data.js"></script>
</td>
<td width="304"><img src="../../../@images/documents/general/spacer.gif" width="1" height="20"></td>
<td width="304"><img src="../../../@images/documents/general/spacer.gif" width="1" height="20"></td>
</tr>
</table>
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Exactly what menu version are you running?

Just to check, are you sure all menu files are in place, and uploaded as text (ASCII)?

When posting code, please use the code tags.
John
Cin Coder
Beginner
Beginner
Posts: 2
Joined: Wed Dec 22, 2004 5:25 pm

ns4 undefined error

Post by Cin Coder »

I am using the latest version from today and I'm sure that all the files are in place.

I ran our existing file thru the converter.....

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

Re: ns4 undefined error

Post by kevin3442 »

Cin Coder wrote:...I ran our existing file thru the converter.....
What file, through what converter? v3 menu_array.js?
Cin Coder wrote:ns4 is undefined
Was it that exactly? Or was it "ns4 is not defined"? This would be typical of the error message you'd see in NS7 if it did not successfully load the file, milonic_src.js.

I tried your sample html code along with with the menu_data.js from the basic horizontal menu sample and everything loaded fine. All I can conclude from that is that there's nothing generally wrong with the .html sample code you provided.

Within the menu system, ns4 is defined in milonic_src.js. Assuming that the error occurs when the browser hits the if(ns4) test when loading the menu .js files, you'd get the "ns4 is not defined" error if milonic_src.js did not load properly for some reason. Why would it not load? Several possibilities. (1) You do not have milonic_src.js on your server. (2) You do have it on your server, but in a path other than the one you are trying to load it from your html code. (3) You have it on your server, but it's corrupted.

Try downloading 5.64 again, then upload the new menu source files. Make sure you upload all three source files to your server: milonic_src.js, mmenudom.js, and mmenuns4.js. Make sure that your html code uses the appropriate path when loading the .js files (I notice in your sample code that you have a lot of ../../../ stuff going on. Might not be the best approach to paths).

Hope that helps,

Kevin
Post Reply