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

'mm_style' is undefined


Poster: darylbeeson
Dated: Friday March 12 2004 - 18:26:23 GMT

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?


Poster: Maz
Dated: Friday March 12 2004 - 20:21:03 GMT

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

Only place menu_data.js within the table.

Regards,
maz

Move menu_data.js out from the table tag


Poster: rudy
Dated: Friday March 12 2004 - 20:57:01 GMT

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


Poster: jraper
Dated: Friday March 12 2004 - 21:39:38 GMT

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!


Poster: John
Dated: Saturday March 13 2004 - 0:55:35 GMT

Looks like you got it fixed...


Poster: rudy
Dated: Saturday March 13 2004 - 3:22:47 GMT

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?


Poster: John
Dated: Saturday March 13 2004 - 23:13:09 GMT

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.

mm_style is undefined


Poster: rudy
Dated: Tuesday March 16 2004 - 18:39:09 GMT

darylbeeson

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

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


Poster: Andy
Dated: Tuesday March 16 2004 - 21:51:38 GMT

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


Poster: Ruth
Dated: Tuesday March 16 2004 - 22:20:20 GMT

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

mm_style undefined


Poster: rudy
Dated: Tuesday March 16 2004 - 22:23:54 GMT

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


Poster: Ruth
Dated: Tuesday March 16 2004 - 22:27:34 GMT

:) We must have been cross posting Rudy.

mm_style undefined


Poster: rudy
Dated: Tuesday March 16 2004 - 22:46:26 GMT

Ruth

Yes, I guess we cross posted on that one.

Good job on finding user darylbeeson's error message problems.


Poster: Andy
Dated: Tuesday March 16 2004 - 22:47:36 GMT

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


Poster: John
Dated: Tuesday March 16 2004 - 22:53:21 GMT

Nice work, Ruth. Many thanks for your efforts... :D


Poster: Andy
Dated: Tuesday March 16 2004 - 22:55:06 GMT

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

-- Andy


Poster: Ruth
Dated: Wednesday March 17 2004 - 1:09:24 GMT

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