Runtime error Object expected

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
winbach
Advanced
Advanced
Posts: 18
Joined: Mon Sep 13, 2004 4:00 pm
Contact:

Runtime error Object expected

Post by winbach »

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!!!!
:(
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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: Select all

<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>
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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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: Select all

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: Select all

...+"IPT LANGUAGE=...
and the space here:

Code: Select all

...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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

You're right, Kevin. Copy and paste is my middle name ;)

Ruth
winbach
Advanced
Advanced
Posts: 18
Joined: Mon Sep 13, 2004 4:00 pm
Contact:

Post by winbach »

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!!!!!
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
winbach
Advanced
Advanced
Posts: 18
Joined: Mon Sep 13, 2004 4:00 pm
Contact:

menu conflict

Post by winbach »

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.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: menu conflict

Post by Ruth »

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

Post by John »

I can see the menu in Safari, but the text is much too small to be read. You have...

Code: Select all

fontsize="8 pt";
I wouldn't go any smaller than 10, and use px for better cross-platform happiness...

Code: Select all

fontsize="10px";
Items that are blank can be deleted from the code...

Code: Select all

subimage="";
Items that are numeric don't need the "", although the menu will now handle that either way...

Code: Select all

subimagepadding=2;
John
winbach
Advanced
Advanced
Posts: 18
Joined: Mon Sep 13, 2004 4:00 pm
Contact:

still don't see menu in MAC browser

Post by winbach »

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!!!!
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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: Select all

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

Post by John »

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... :roll:
John
winbach
Advanced
Advanced
Posts: 18
Joined: Mon Sep 13, 2004 4:00 pm
Contact:

This worked!!!!

Post by winbach »

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!!
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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 :P :cry:

-- Andy
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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 :P :cry:
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... :D
John
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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

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

-- Andy
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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 :!:
John
marty
Site Admin
Posts: 116
Joined: Tue May 21, 2002 6:48 pm
Location: Birmingham, UK

Post by marty »

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

-Marty :D
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

You're right. It's just the opposite over here. Typically, the more in advance you buy the better the deal (unless you go standby or something silly like that!).
John
Post Reply