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:10
Runtime error Object expected
Poster: winbach
Dated: Monday September 13 2004 - 16:26:07 BST
Greetings. I am getting a runtime error with my code for the new version. It is linked to the milonic_src.js file. The link to my page is
http://www.winbach.com/DCX
HELP!!!!
Poster: Ruth
Dated: Monday September 13 2004 - 17:37:11 BST
I noticed that this part of the menu calls has capitals in it and changed it to lower case, that seemed to stop the error and the menu showed up
Code:
<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>
<!--
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>
Also, you are using a style called menuStyle, you have it defined on the page with the menu in the table, but in the menu_data.js file you also have a style called menuStyle. You need to rename one of those. Finally, the table placement directions found here notes the calls for the menu should be the first item right after the body tag on the page, there's an explanation about browsers and why it needs to be that way.
Ruth
Ruth
Poster: kevin3442
Dated: Monday September 13 2004 - 18:18:56 BST
Hi Winbach,
This was one of the oddest I've seen in a while. Ruth is correct in that the following line of your code is the cause:
Code:
else _d.write("<SCR"+"IPT LANGUAGE=JavaScript SRC=mmenudom.js><\/SCR"+"IPT>");
However, it's not the caps that cause the problem (the attribute names are not case sensitive). So, if you manually edit that line and replace the upper case letters with lower, you'll probably find that you still have the problem. I'm guessing that Ruth probably cut and pasted her lowercase version into the test code that she used (right Ruth?), which inadvertently solved the problem. The problem is in two places in your line of code. The space here:
Code:
...+"IPT LANGUAGE=...
and the space here:
Code:
...JavaScript SRC=...
are not "real" spaces. They are both hex code A0 (decimal 160) instead of 20 (decimal 32). Visually, both appear as a space. But hex A0 (decimal 160) is the code for what is, in html, a non-breaking space. So essentially, your js code has two non-breaking spaces in it, which cause that line of code not to work; so mmenudom.js is never loaded. If you delete those two spaces and put in a normal space, the problem will go away.
Of greater concern is, how did those A0's get in there??? How did you get that code into your page... cut and paste? The fact that your attribute names are all caps tells me that you didn't just cut and paste from the downloaded source files, because those are not in all caps. There's been some editing along the way... what editor do you use?
Cheers,
Kevin
Poster: Ruth
Dated: Monday September 13 2004 - 18:22:58 BST
You're right, Kevin. Copy and paste is my middle name
Ruth
Poster: winbach
Dated: Monday September 13 2004 - 22:52:01 BST
Greetings.
Yes, cut and paste is also my middle name.. I actually cut and pasted from the how to build the menu in a table and I think that is where I got all of the extra stuff.. What a goof.
However, now I can see the menus on Windows but am unable to see them on the Mac OS X system. Any suggestions???
Thanks so much for your help today!!!!!
Poster: Ruth
Dated: Monday September 13 2004 - 23:12:32 BST
I don't know if the old link has been fix with your corrections, but if that's the case: in the menu_data.js file you have a menu style defined which you've named menuStyle, then on the page with the main menu you declare a different menu style but you name it the same. You need to rename one of them. The main menu still uses the menu_data.js file, I'm not really sure why you have the style defined on the page instead of in the file itself which is all you need. But, you can't have them the same name. I don't know if that will fix the Mac OS problem. Which browser is it that is not showing the menu?
Ruth
menu conflict
Poster: winbach
Dated: Tuesday September 14 2004 - 0:08:02 BST
Thanks for the feedback. I am unable to see my menus in any Mac browser at this point but everything comes up in Windows. I not sure how this works so I named the menu in the table menustyle2 and kept menustyle in the milonic_data.js file. Is that correct?? unfortunately even with the new names it does not work. Drat.
Any other suggestions? Do I not need to define the menu parameters in the table on my home page?? As you can see I am a bit lost.
Thanks so much.
Re: menu conflict
Poster: Ruth
Dated: Tuesday September 14 2004 - 2:54:49 BST
winbach wrote:
.... I not sure how this works ... As you can see I am a bit lost.
Well, I'm not sure how it works either and am frequently lost!
winbach wrote:
.... so I named the menu in the table menustyle2 and kept menustyle in the milonic_data.js file. Is that correct?? ... Do I not need to define the menu parameters in the table on my home page??
Here's a link for placing the menu in the table http://www.milonic.com/tablemenu.php It's a bit easier to understand, I believe, than the one that comes with the sample.
As to putting it in the table, no, you do not need to put the style definition in the table, that remains in the menu_data.js file. Even though the main menu is in the table cell, it still functions with the menu_data.js file which functions in conjunction with the 3 program files. The only thing you put in the table is the main menu starting with the script tags you have, then with(new menuname("Main Menu")){ or whatever you've called it, and so on.
As to naming the styles, you can name them whatever you want, just make sure you put the correct style name with the menu to which you want it applied. So, you could have mainStyle, substyle, menu1Style and so on. There's a section on the site called Beginners' Guide, it's very basic but it's pretty quick reading and a good starting place for those who are new to the menu.
Ruth
Poster: John
Dated: Tuesday September 14 2004 - 5:15:48 BST
I can see the menu in Safari, but the text is much too small to be read. You have...
Code:
fontsize="8 pt";
I wouldn't go any smaller than 10, and use px for better cross-platform happiness...
Code:
fontsize="10px";
Items that are blank can be deleted from the code...
Code:
subimage="";
Items that are numeric don't need the "", although the menu will now handle that either way...
Code:
subimagepadding=2;
still don't see menu in MAC browser
Poster: winbach
Dated: Tuesday September 14 2004 - 17:03:00 BST
Greetings. I made the changes you suggested but I still can't see the menu. What operating system are you running by chance for the MAC. I am in 10.2.8... HELP!!!!
Poster: Andy
Dated: Wednesday September 15 2004 - 9:18:52 BST
ARGGHH - I HATE INTERNET EXPLORER FOR THE MAC - WHY DO PEOPLE STILL USE THIS GOD DAMN BROWSER - IT'S WORSE THAN NETSCAPE 4 EVER WAS - A LOT WORSE.
Phew, sorry about that.
Anyway, you'll love this. If you replace the main menu inside the table cell with the following, you should be able to see the menu appear in IE for the Mac.
Code:
<SCRIPT type=text/javascript>
with(new menuname("Main Menu")){
style=menuStyle2;
alwaysvisible=1;
screenposition="center";
orientation="horizontal";
aI("text=HOME;url=index.html");
aI("text=PRODUCTS;showmenu=Products;");
aI("text=COMPANY PROFILE;showmenu=Company Profile;");
aI("text=MANUFACTURING CAPABILITIES;showmenu=Manufacturing Capabilities;");
aI("text=ENGINEERING;showmenu=Engineering;");
aI("text=QUALITY;showmenu=Quality;");
aI("text=CONTACT US;url=#");
}
drawMenus();
</SCRIPT>
with(new menuname("Main Menu")){
style=menuStyle2;
alwaysvisible=1;
screenposition="center";
orientation="horizontal";
aI("text=HOME;url=index.html");
aI("text=PRODUCTS;showmenu=Products;");
aI("text=COMPANY PROFILE;showmenu=Company Profile;");
aI("text=MANUFACTURING CAPABILITIES;showmenu=Manufacturing Capabilities;");
aI("text=ENGINEERING;showmenu=Engineering;");
aI("text=QUALITY;showmenu=Quality;");
aI("text=CONTACT US;url=#");
}
drawMenus();
</SCRIPT>
Don't try and find any changes in what you have already and what you see above, there are some but you simply can't see them. It's a magical thing that only Internet Explorer for the Mac can understand.
Trust me, this will work. Simply copying and pasting the above code (which is exactly the same as what you already have) into your HTML and this will perform the magical, mysterious wonder and fix your menu.
I apologise for my behaviour and tone of the message, it seems that this magically marvellous feat that IE/Mac can perform needs treating in the same manner.
Let me know if you have any trouble with this, or if I need sectioning
Cheers
Andy
Poster: John
Dated: Wednesday September 15 2004 - 15:14:37 BST
Andy wrote:
[Let me know if you have any trouble with this, or if I need sectioning
Yipes That piece of junk finally got the blast it deserves. And you're right - no reason at all for folks to keep using it.
However - if you keep this up they might not let you on the aircraft...
This worked!!!!
Poster: winbach
Dated: Wednesday September 15 2004 - 16:29:13 BST
Wow Andy it is magic!!!
Thank you so much for all of your help on this one. I really really really really appreciate all of your feedback!!
Poster: Andy
Dated: Thursday September 16 2004 - 11:04:45 BST
Quote:
However - if you keep this up they might not let you on the aircraft...
I better keep my gob shut from now on then.
I can always rant from the comfort of my hotel suite, once I'm in the country - In fact, depending on the flight I might be in just the right mood for a good rant. All the upgrades are gone so I gotta slum it in economy
-- Andy
Poster: John
Dated: Thursday September 16 2004 - 14:59:18 BST
Andy wrote:
In fact, depending on the flight I might be in just the right mood for a good rant. All the upgrades are gone so I gotta slum it in economy
Oh, no! Bummer. Are you flying direct?
With all the flying I used to do for Apple, the folks at the ticket counters and even on the phone got to know me on a first name basis. By the time I got to the counter it was always, "We've already got you upgraded to first class, John". Only way to go...
Poster: Andy
Dated: Thursday September 16 2004 - 17:44:49 BST
Quote:
Oh, no! Bummer. Are you flying direct?
Yeppers, all 10 hours of it. Looked on British Airways website for costs of flying in the up-stairs bit on a BA Jumbo to LAS from London. Came to £32,000.00 for 4 people
Thats, about $55,000.00 USD - It's a little too much to pay don't ya think, I need that much for the roulette tables alone
-- Andy
Poster: John
Dated: Thursday September 16 2004 - 18:37:15 BST
Holy c**p! What a rip. That can't be for advance purchase, though - correct?
Just looked at American. They don't have anything direct, but for 2 months out it was $38,000 for 4 folks. Damn, Sam
Poster: marty
Dated: Thursday September 16 2004 - 19:20:19 BST
Hey John,
I may be wrong but the ridiculous UK air travel system seems to work a little different to over there.
Flying out of this country is such a rigmarole, there are no or very little consessions for booking in advance, infact the later you leave it the better the deal you get. I guess very few people decide to get on a plane last minute round these parts.
woohoo 4 days to go
-Marty