Object Expected Errors

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

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.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
SpeedStreet
Advanced
Advanced
Posts: 14
Joined: Sat Sep 20, 2003 7:34 pm

Post by SpeedStreet »

I don't know why...but now it is working....

Code: Select all

<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?
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

//<![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.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

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
SpeedStreet
Advanced
Advanced
Posts: 14
Joined: Sat Sep 20, 2003 7:34 pm

Post by SpeedStreet »

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!
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

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
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

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.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
SpeedStreet
Advanced
Advanced
Posts: 14
Joined: Sat Sep 20, 2003 7:34 pm

Post by SpeedStreet »

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

Post by John »

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.
John
Post Reply