'mm_style' is undefined

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
darylbeeson
Beginner
Beginner
Posts: 1
Joined: Fri Mar 12, 2004 7:04 pm
Location: Boise, Idaho

'mm_style' is undefined

Post by darylbeeson »

I'm getting a "'mm_style' is undefined" error in IE6.0.2. I have looked at other posts relating to this error but have been unable to resolve the issue. Hope somebody can help me out.

Check out:
http://scpglobal2.pair.com/company/about.php

Rolling over the left sidebar menu produces the error. I'm running version 5.06. Any ideas?
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Try taking the script out and placing it under the <body> tag.

Only place menu_data.js within the table.

Regards,
maz
User avatar
rudy
Mega User
Mega User
Posts: 161
Joined: Thu Jan 15, 2004 11:39 pm
Location: Scottsdale, Arizona
Contact:

Move menu_data.js out from the table tag

Post by rudy »

darylbeeson

The suggestion Maz gave should fix your javascript error (Note: you may also want to try closing the table tag </table> before starting the next table). It looks like you have the .js files listed in the correct order on the menu page, as described in #3 of the install.txt file that was downloaded with the zip file. Actually, I would put all this code:

Code: Select all

<SCRIPT language=JavaScript src="/menu/milonic_src.js" type=text/javascript></SCRIPT>	
<script	language=JavaScript>
	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>
in the <HEAD></HEAD> tag, taking it out of the <BODY> tag.


also, I see you have the newest Milonic menu RC, which is good - would suggest you add your License Number: to the milonic_src.js file and re-upload it to your server.
Last edited by rudy on Fri Mar 12, 2004 11:22 pm, edited 3 times in total.
Rudy
jraper
Beginner
Beginner
Posts: 7
Joined: Tue Jul 23, 2002 7:21 pm

Post by jraper »

darylbeeson,

I got that error too and finally tracked it down. I had the script containing my style definitions "with(menuStyle=new mm_style()){ ..." loading BEFORE milonic_src.js, mmenuns4.js, and mmenudom.js. Ensuring that the style and enty definitions load last (not first) solved the problem.

Pay particular attention to item 3 in the installation instructions ("install.txt") that came with Version 5 of Milonic.

Hope this helps - Good Luck!
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Looks like you got it fixed...
John
User avatar
rudy
Mega User
Mega User
Posts: 161
Joined: Thu Jan 15, 2004 11:39 pm
Location: Scottsdale, Arizona
Contact:

Post by rudy »

I checked all the code in your menu_data.js file and it looks fine. The Milonic menu (which is the horizontal menu on your web site) seems to work fine. It's the vertical menu on your site that is causing a javascript error.
I tried all the links and they work fine, so you can try to find the javascript error or simple add the javascript below into the <HEAD> tag of your site and it will take care of the error message. As long as everything is working and loading correctly, who cares - javascript error messages can be a pain and seldom keep the script from working - they just make an annoying message and let you know something isn't scripted just as it wishes.


<SCRIPT LANGUAGE="JavaScript">
<!--
// Keep the follwing line down when you use this script
// Found at the Javascript Libary http://www.geocities.com/ResearchTriangle/8870/
// More scripts are available there

function stopError() {
return true;
}
window.onerror = stopError;
// -->
</SCRIPT>

Good Luck and let us know if this works for you?
Last edited by rudy on Tue Mar 16, 2004 7:40 pm, edited 1 time in total.
Rudy
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Definitely not a good idea, Rudy. While most of the JS error messages leave a lot to be desired, at least they let you know there is something wrong and point you in the general direction of the problem. Trapping the error messages out is like sticking your head in the sand - you won't see the error, but it's still there.
John
User avatar
rudy
Mega User
Mega User
Posts: 161
Joined: Thu Jan 15, 2004 11:39 pm
Location: Scottsdale, Arizona
Contact:

mm_style is undefined

Post by rudy »

darylbeeson

I see you took my advice and used the following script...

Code: Select all

<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
function stopError() { 
return true; 
} 
window.onerror = stopError; 
// --> 
</SCRIPT>
All links now work on your verticle menu without any "error on page" messages in the task bar.

Your page is looking great :lol:
Rudy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

WOAH!! - Talk about brushing it under the rug :)

Well, if you are happy with suppressing error messages then on your head be it. But be warned that these things have a nasty habit of coming back to haunt you.

Basically the error messages are there to warn you (and advise) about problems, it's always better to find the source and fix the problem.

Like I say, if you are happy with the results then fine but I (personally) would worry about this.

Cheers
Andy
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I agree with John and Andy.I downloaded your page and tried running it without that code, it threw
6 errors and wouldn't load.
I found the errors. This will be a bit long, I'm kind of wordy trying to make sure I'm clear in what I say.

1. on the page you have a call for the font.css file in the table cell where you have the menu.
That causes nn4 to throw an error and not load the page. there's no reason for that to be there,
it's already called in the head.

2. put the calls for the menu back in the head.

Code: Select all

<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>	
<script language=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 language=JavaScript src="menu_2_sidebar.js" type=text/javascript></SCRIPT>
3. in your sidebar.js file you should remove any reference in the menustyle definition to the border and
rename the style to menuStyle2.

Code: Select all

with(menuStyle2=new mm_style()){
onbgcolor="";
oncolor="#FFFFFF";
offbgcolor="";
offcolor="#FFFFFF";
padding=4;
fontsize="12";
etc.
}
4. you are putting the menu in a table cell but are tyring to get it there by calling the file instead of correctly by
actually putting the menu there which is the correct method.
remove the call for menu_2_sidebar.js from that cell, in that file remove all reference to the menu and put it in
the cell itself inside of script tags and with drawmenus() after the final }

Code: Select all

<td align="center" valign="top">
<img src="spacer.gif" width="191" height="1" border="3">
<SCRIPT  type=text/javascript>with(milonic=new menuname("Menu")){
style=menuStyle2;
top=100;
left=15;
alwaysvisible=1;
orientation="vertical";
position="relative";
aI("text=COMPANY;fontsize=16;fontweight=bold;oncolor=white;offcolor=white;offbgcolor=none;
offborder=0px solid #aaaaaa;onborder=0px solid #aaaaaa;align=Left;itemwidth=170;");
aI("text= About;url=about.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
aI("text= Mission/Vision ;url=mission.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
aI("text= Board of Directors ;url=board.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
aI("text= Executive Staff ;url=executive.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
aI("text= Worldwide Offices ;url=worldwide.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
aI("text= History ;url=history.php;pagebgcolor=#860156;oncolor=white;onbgcolor=none;
offcolor=white;offbgcolor=none;align=left;onborder=1px solid #ffffff;");
}

drawMenus();

</SCRIPT>
5. I'd download the tablebound sample for reference.

Here is the page with these corrections. It works in nn4.79, 6, 7, opera 6, 7, firebird.07 and ie 5.5. Of course the
flash doesn't since I don't have them so it just keeps showing as loading items.

http://www.poems2u.com/1/c/new_about.html

Finally, I'm not sure why you have two files, perhaps for future design, but you do not need that sidebar.js file.
Just put the menuStyle2 in the menu_data.js file along with the other menuStyle definition, get rid of the call for the sidebar.js file and the menu will work fine.

http://www.poems2u.com/1/c/new_about_1file.html

Ruth

If i've posted a page please let me know when you're done.
User avatar
rudy
Mega User
Mega User
Posts: 161
Joined: Thu Jan 15, 2004 11:39 pm
Location: Scottsdale, Arizona
Contact:

mm_style undefined

Post by rudy »

It's always best to write code that doesn't produce an error message, thats a given. The owner of this site had the dreaded yellow triangle with the words "error or page". He had apparently spent hours, if not days trying to find the cause of the error. He probably felt it wasn't worth continuing with the Web site with this error message showing up on his opening page. Let's face it, visitors to his site are going to go somewhere else as soon as they see the error message.

This javascript code simply removes the error message and yes the coding error causing this error message is still there.

At least the site is useable and he has half a chance for visitors to view the rest of his site.

If he can find the cause of his error message and correct it, that's certainly the best way to do it, but I really dought whether this will cause future problems with his site. If it does, all he has to do is remove the script.

No disrespect intended, but I haven't seen anyone else here offer him any suggestions, so I offered him something to get him going. While the site is working now, he can continue to search out the cause of the error message and fix it if possible. In the mean time, he will probably get some visitors viewing his Web site.

I guess we'll just have to agree to disagree on this one :)
Rudy
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

:) We must have been cross posting Rudy.
User avatar
rudy
Mega User
Mega User
Posts: 161
Joined: Thu Jan 15, 2004 11:39 pm
Location: Scottsdale, Arizona
Contact:

mm_style undefined

Post by rudy »

Ruth

Yes, I guess we cross posted on that one.

Good job on finding user darylbeeson's error message problems.
Rudy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Right then, I've been tweaking.

I think the problem was down to oncolor=#none; in the menu items.

Anyway, the data was a little messy so I tidied things up a bit, no errors now:



Code: Select all

_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_followSpeed=5                // Follow scrolling speed
_followRate=50                // Follow scrolling Rate
_subOffsetTop=0               // Sub menu top offset
_subOffsetLeft=0            // Sub menu left offset
_scrollAmount=3               // Only needed for Netscape 4.x
_scrollDelay=20               // Only needed for Netcsape 4.x



with(menuStyle=new mm_style()){
oncolor="#FFFFFF";
offcolor="#FFFFFF";
padding=4;
fontsize="12";
headercolor="#000000";
headerbgcolor="#ffffff";
overfilter="Fade(duration=0.2);Alpha(opacity=100)";
outfilter="randomdissolve(duration=0.3)";
onborder="1px solid #ffffff";
pagebgcolor="#860156";
}


with(milonic=new menuname("Menu")){
style=menuStyle;
top=100;
left=15;
alwaysvisible=1;
orientation="vertical";
aI("text=COMPANY;fontsize=16;fontweight=bold;itemwidth=170;");
aI("text= About ;url=about.php;");
aI("text= Mission/Vision ;url=mission.php;");
aI("text= Board of Directors ;url=board.php;");
aI("text= Executive Staff ;url=executive.php;");
aI("text= Worldwide Offices ;url=worldwide.php;");
aI("text= History ;url=history.php;");
}

drawMenus();


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

Post by John »

Nice work, Ruth. Many thanks for your efforts... :D
John
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

oops, just seen Ruth's work - Sorry I should read things first shouldn't I :oops:

-- Andy
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

It helps me with my own trying to find things on others. Just takes me a loooong time to figure it out.

Ruth

ps, thanks, Andy :)
Post Reply