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:11
Object Expected Errors
Poster: SpeedStreet
Dated: Saturday September 20 2003 - 19:39:47 BST
Code:
<!-- Begin Navigation -->
<script language="javascript" src="milonic_src.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
//<![CDATA[ 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 language="javascript" src="menu_data.js" type="text/javascript"></script>
<!-- End Navigation -->
<script language="javascript" src="milonic_src.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
//<![CDATA[ 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 language="javascript" src="menu_data.js" type="text/javascript"></script>
<!-- End Navigation -->
No other changes made to the code. The .js files are located in the root directory for testing purposes. Yet, the menu will not load, and in IE I am getting line 17 char 1758 object expected errors.
Being that the code is compressed and damned near impossible to read, I have no choice but to ask all of you for help.
Thanks!
Poster: SpeedStreet
Dated: Saturday September 20 2003 - 19:40:41 BST
BTW - The above code snippet is complient with anyone who is interested in maintaining an XHTML 1.0 compliant website...so feel free to use if you like
Poster: Maz
Dated: Saturday September 20 2003 - 21:27:08 BST
Thank you, I wasn't sure about putting back cdata on xhtml template. Now if I can figure out the correct doctype...?
Have you considered the path before file names?
You could download a new menu and work from there.
Regards
maz
Poster: Hergio
Dated: Saturday September 20 2003 - 21:34:48 BST
Quote:
Being that the code is compressed and damned near impossible to read, I have no choice but to ask all of you for help.
The code is compressed to save space and also keep people from messing with it too much. You make it sound like its a bad thing you are asking us. Sorry. You are referencing your script files without anything in front of them, i.e. src="milonic_src.js", so this means the page is looking into the current directory that the page is in. So unless your page is also in the root, like you said your menu files are, then it won't work. They all have to be in the same directory.
Quote:
//<![CDATA[ if(ns4)_d.write("<scr"+"ipt language=JavaScript
I am just catching on to the whole compliance thing, but inside of script tags, // means comment the line so doesn't this comment out this entire line? The above quote is contained within script tags.
Poster: SpeedStreet
Dated: Saturday September 20 2003 - 21:51:49 BST
The Cdata comment allows the code to pass through similarly to the whole commenting out of javascript from way back when.
The copy of the script was downloaded today, and it is 100% fresh.
As for the compression...I think its great! It's just a pain in the butt to work on when you have to debug it, but it is definitely a tradeoff I am willing to make
All files are currently in the same directory. Sorry about the vagueness of my last reply.
Poster: Maz
Dated: Saturday September 20 2003 - 21:52:23 BST
This is the original version 3, to compare:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Mercury Exposure
</title>
<link rel="stylesheet" type="text/css" href="template/main/style.css">
</head>
<body>
<script type="text/javascript" language="JavaScript">
//<![CDATA[
/*
Milonic DHTML Website Navigation Menu - Version 3.4
License number - 187570
Written by Andy Woolley - Copyright 2002 (c) Milonic Solutions Limited. All Rights Reserved.
Please visit http://www.milonic.co.uk/menu or e-mail menu3 __at__ milonic.com for more information.
The Free use of this menu is only available to Non-Profit, Educational & Personal web sites.
Commercial and Corporate licenses are available for use on all other web sites & Intranets.
All Copyright notices MUST remain in place at ALL times and, please keep us informed of your
intentions to use the menu and send us your URL.
*/
//]]>
</script>
<script language="JavaScript" src="template/main/menu_array.js" type="text/javascript"></script>
<script language="JavaScript" src="template/main/mmenu.js" type="text/javascript"></script>
Poster: SpeedStreet
Dated: Saturday September 20 2003 - 21:52:51 BST
maz wrote:
Thank you, I wasn't sure about putting back cdata on xhtml template. Now if I can figure out the correct doctype...?
Have you considered the path before file names?
You could download a new menu and work from there.
Regards
maz
Have you considered the path before file names?
You could download a new menu and work from there.
Regards
maz
Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This Doctype allows you to work in the transitional mode...so everything isn't as strict...but still compliant
Poster: Hergio
Dated: Saturday September 20 2003 - 21:55:20 BST
Notice how Maz had her //<
None of the compressed files are intended to be edited. The only file that does is menu_data.js (or whatever you have named it).
Poster: John
Dated: Sunday September 21 2003 - 4:53:25 BST
SpeedStreet wrote:
http://www.speedstreet.org/testmenu.html
You don't have the calls to the rest of the menu code on this page...
Code:
<script language="javascript" 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>
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>
Poster: SpeedStreet
Dated: Sunday September 21 2003 - 6:36:10 BST
Whoops...
I tried removing that to see if that would help...
dropped it back in...still nothing.
Sorry bout that.
Poster: Hergio
Dated: Sunday September 21 2003 - 7:39:19 BST
Went to http://www.speedstreet.org/testmenu.html and viewed the source and all I saw was
Code:
<html><body>
<script language="javascript" src="milonic_src.js" type="text/javascript">
</script>
<script language="javascript" src="menu_data.js" type="text/javascript">
</script>
</body></html>
You're not specifying mmenudom or mmenuns4 at all. As John said your js includes need to look like this....<script language="javascript" src="milonic_src.js" type="text/javascript">
</script>
<script language="javascript" src="menu_data.js" type="text/javascript">
</script>
</body></html>
Code:
<script language="javascript" src="milonic_src.js" type="text/javascript">
</script>
<script language="javascript" 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 language="javascript" src="menu_data.js" type="text/javascript">
</script>
</script>
<script language="javascript" 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 language="javascript" src="menu_data.js" type="text/javascript">
</script>
I could have sworn you almost had it the first time around, but that CDATA stuff with the comment thing I swear was screwing it up.
Poster: Maz
Dated: Sunday September 21 2003 - 11:32:29 BST
My guess is it needs a slash for the path /menu.js
Poster: Hergio
Dated: Sunday September 21 2003 - 20:04:46 BST
Naw that doesnt seem to be the problem. This link and the others like it all work fine: http://www.speedstreet.org/milonic_src.js That means all the js files are located in the root or at the very least in the samedirectory as the page we are viewing.
The common error
Line: 17
Char: 1768
Error: Object Expected
is a very common error. Generally you get this error when menu_data is trying to access the first thing that SHOULD be defined in either mmenudom or mmenuns4 (whatever milonic_src decided was best). I BELIEVE (in this case) that its when the first style declaration in menu_data occurs, because new mm_style is not defined anywhere as it doesnt know where mmenudom is.
Poster: SpeedStreet
Dated: Sunday September 21 2003 - 20:12:41 BST
I don't know why...but now it is working....
Code:
<script language="javascript" src="./menu/milonic_src.js" type="text/javascript">
</script>
<script language="javascript" type="text/javascript">
//<![CDATA[
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=./menu/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=./menu/mmenudom.js><\/scr"+"ipt>");
//]]>
</script>
<script language="javascript" src="./menu/menu_data.js" type="text/javascript">
</script>
</script>
<script language="javascript" type="text/javascript">
//<![CDATA[
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=./menu/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=./menu/mmenudom.js><\/scr"+"ipt>");
//]]>
</script>
<script language="javascript" src="./menu/menu_data.js" type="text/javascript">
</script>
This is functioning perfectly now...any ideas?
Poster: Hergio
Dated: Sunday September 21 2003 - 20:41:55 BST
Quote:
//<
