Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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 -->


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 :D


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

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 :D


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


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 :D


Poster: Hergio
Dated: Saturday September 20 2003 - 21:55:20 BST

Notice how Maz had her //<![CDATA[ on a separate line from the rest of the code, I think you need to do that too. If you put //<![CDATA[ on a line and then start the java code, the entire line is ignored. You need to start the code on the following line. Am I right?


Poster: Maz
Dated: Saturday September 20 2003 - 22:21:10 BST

Thank you,
This is a big help getting xml correct.

The current RC is misbehaving,
I'm waiting on the next download.
Regards,
maz


Poster: Maz
Dated: Saturday September 20 2003 - 22:37:40 BST

That was funny, besides the fact my top menu doesn't align since the 15th, two text capital E's with hats perched themselves in the top left hand corner. see www

maz


Poster: SpeedStreet
Dated: Sunday September 21 2003 - 1:12:37 BST

I should have pointed out that I have tried it without the XHTML markup....in fact, I tried it out of the box, and still had issues...


Poster: SpeedStreet
Dated: Sunday September 21 2003 - 1:18:16 BST

As a test, I took the code from install, threw it in blank.htm (provided with Milonic Script) and it _still_ did not work. :(


It's being a little :evil:



:D


Poster: Maz
Dated: Sunday September 21 2003 - 3:00:16 BST

blank.htm is just something it needs on a secure server.


Poster: Hergio
Dated: Sunday September 21 2003 - 3:40:55 BST

Yeah I wouldnt throw it in blank.htm. Throw them in a different page. Also, you also installed the mmenudom and the mmenuns4 files in the directory too, right? Do you have a URL we could see? So we can see it not showing up as well as view your entire code?


Poster: SpeedStreet
Dated: Sunday September 21 2003 - 4:13:54 BST

Sure thing.


I really appreciate all of the help you all are providing...next time I make cookies, you are on my list ;)

Here are the links to the pages:
http://www.speedstreet.org/newindex.php
http://www.speedstreet.org/testmenu.html
All js scripts are located in the root directory as well as /js/ (tried both for testing purposes

This is the first time I have ever posted this link public...let me know what you think :D


Poster: John
Dated: Sunday September 21 2003 - 4:42:30 BST

SpeedStreet wrote:
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 :D

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>


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....
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>


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>


This is functioning perfectly now...any ideas?


Poster: Hergio
Dated: Sunday September 21 2003 - 20:41:55 BST

Quote:
//<![CDATA[
if(ns4)_d.write("<scr"+"ipt language=JavaScript

Notice how you have these two on separate lines. Thats why it works. The // was commenting out the entire line so it wasn't including the rest of that line. I was saying that all along. Now the // only comments out the CDATA line which is right, but the rest of the script gets read correctly.


Poster: Maz
Dated: Sunday September 21 2003 - 21:01:13 BST

Thanks Dave :D
I might have missed it.

This site is giving me ideas for my tools menu, I like 3D effects.

All that's needed now is a little tweeking, or is it tweaking, never know which one is correct, for a ; error and an object error " ".

Regards
maz


Poster: SpeedStreet
Dated: Sunday September 21 2003 - 21:08:04 BST

I had tried the CDATA thing before, and it didn't work.

Guess what? The menu just decided to stop working...and I didn't even do anything to it!

It seems like it is a pretty nasty issue with precaching and execution.

<sigh> I am starting to feel like I should just revert back to v3

thanks for all the help everyone...you guys rock!


Poster: Maz
Dated: Sunday September 21 2003 - 21:18:26 BST

You now have the right combination of script path and CDATA.

The reason the menu doesn't appear is the 2 errors, these are little errors in your menu data, be careful to change one item at a time and go back if the menu doesn't appear. I keep my editor on save instead of save as, so I can press the back button and figure out where I went wrong.

Check it against an original menu_data file or post it here and I'll take a look.

Regards
maz


Poster: Hergio
Dated: Monday September 22 2003 - 13:48:59 BST

Ok speedstreet, I am looking at your homepage and I see some things you need to fix. First I thought we were still looking at your test page, I JUST realized you are back to putting it on your newindex.php page. I see the fixed CDATA, good job.

Ok, when you reference your script files, you seem to be doing it incorrectly. In your SCRIPT tags, you are referencing the menu files like so.. src="./menu/milonic_src.js" and you are doing this for all of them. The . in front of the slash is incorrect, I am unsure of what one period even does. What you need to do is remove the period. Your menu files are located in a menu directory located just inside your root. So beginning the URLS with one / will tell the browser to look for your menu files starting at the root (hence the slash) and then look for a menu directory immediately in the root (hence the menu/) and then inside that look for the menu files. So your script tags should say src="/menu/milonic_src.js" (same for the others) and this will also allow you to use those includes ANYWHERE in your site, so no matter what page/directory you include the menu code onto, it will always look starting from the root and into your menu dir.

In your menu_data file...in your style definition, you have a couple numeric variables with quotes around them. Like separatorsize="1". You dont need quotes around values that are JUST numeric. So anywhere where you have something like "1" or "2", just make it 1 or 2. But if there is anything alpha or sybmolic, like 12px or #449502, then yes, you still need the quotes...and you're ok with the rest of it, but just remember for future reference.

Also you have one style defined that all your menus use. This is ok, but in that style you have an overfilter that uses Fade. You shouldnt have fade on a menu that is alwaysvisible (which your main menu is), because fade only works on menus that will be appearing and disappearing, so why put it on a menu that will always stay viewable? Having fade on menus like your main menu has caused problems in the past. So to remedy this, make a exact copy of your current style, and change its name. Then take out the FADE filter in the overfilter of the new style and also comment out the outfilter line entirely. Then make your main menu use this NEW style you just created.

Besides that, the rest looks ok. Give these few things a shot, and let me know what happens.


Poster: SpeedStreet
Dated: Monday September 22 2003 - 14:27:16 BST

Sure thing...I will definitely try all of these out.

For reference, however, I should note that the only things I messed with in the JS files were trying to create the position relatively and a few minor changes to menu times. The quotes and whatnot are all in the downloadable version I picked up from here a few days ago.


Poster: John
Dated: Monday September 22 2003 - 14:52:47 BST

SpeedStreet wrote:
For reference, however, I should note that the only things I messed with in the JS files were trying to create the position relatively and a few minor changes to menu times. The quotes and whatnot are all in the downloadable version I picked up from here a few days ago.

And so they are.

We'll fix it.