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:46
'mm_style is undefined'
Poster: soh
Dated: Saturday April 30 2005 - 2:56:32 BST
I have been getting the 'mm_style is undefined' message on the following url: http://www.ncic.org.uk/
I have read and read articles about how to repair the scripting problem, but cannot identify with any of the problems. I know I have messed it up somehow, but even when I replaced the url with a new page, it did not go away.
Secondly, and I do not think this is bad form, because it may be connected, but I really want to have the menu repeated identically on every page, by including it in the top shared border in Microsoft Frontpage. There was a help file but I am not clear how to embed in a share border. Any help would really be appreciated. Thanks
Poster: Ruth
Dated: Saturday April 30 2005 - 3:28:42 BST
Hi SOH,
You seem to have calls for all the files twice, once right after the body tag, and then again in a table cell. Are you attempting to put the main menu in a table cell? If so, you need to take it out of the menu_data.js file and paste it in the table cell, include a drawmenus() and enclose that inside of script tags. YOu put the call for the files right after the body tag. If you wanted to do it with files, you could put the main menu into it's own .js file and call that in the table cell, but the other files go right after the body tag so that all the submenus are built before the main menu is built.
Ruth
Poster: kevin3442
Dated: Saturday April 30 2005 - 3:38:03 BST
Hello soh,
The error is casued by the following:
In your html, you have the following code
Code:
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
toward the top of your file, around line 13, soon afte the <body> tag. Since milonic_src.js has not yet been loaded, you're getting a "ns4 is not defined" error (caused by the if(ns4) bit), which is followed by a "mm_style is undefined" error, caused by the execution of the code in menu_data.js. mm_style is undefined at that point, because you have not loaded milonic_src.js first.
Further down in the html code, around line 63, you have
Code:
<script type="text/javascript" src="milonic_src.js"></script>
<div class=milonic> </div>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
<div class=milonic> </div>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
Which is why your menu shows up. Note that you do load milonic_src.js first here, which is good. But you should have only one block of code to load the base menu scripts and your menu-data.js file. the second block is in a table, which is not quite done properly either. But one thing at a time... you might want to remove the first block of code (the one causing the errors) and see where that gets you.
I don't work with shared borders in FrontPage, so I can't be much help there. I'm sure you can do it (I seem to recall some threads about it in these forums), but I don't know how.
Cheers,
Kevin
Poster: kevin3442
Dated: Saturday April 30 2005 - 3:38:46 BST
Hmmm... Looks like Ruth beat me to it! I swear that wasn't there when I started my reply!
Kevin
Poster: Ruth
Dated: Saturday April 30 2005 - 4:31:18 BST
I made it invisible so you couldn't see it. Actually, I have discovered that if you are writing while online you won't see any other posts, and I think it puts the time at the time you click the post reply rather than when you actually submit it.
Ruth
mm_style
Poster: soh
Dated: Saturday April 30 2005 - 15:14:38 BST
thanks kevin and ruth.
What an incredible turnaround your forum has. I went to bed and got up to answers! Really appreciate it, although my frontpage borders problem seems too complex for a poor amateur so I manually inserted the menu code into each of about 400 pages rather than go through the processes described elsewhere. Along the way mm_style sorted itself out. Thanks again
Poster: Ruth
Dated: Saturday April 30 2005 - 17:28:51 BST
Hi
I looked at your source code and it looks like you are trying to put the main menu in a table cell. If that's true, the only thing that gets put into that cell is the main menu. It gets removed from the menu_data.js file and either put into it's own file i.e. main_table_data.js, and that gets called in the table cell, or you put the actual main menu in the table cell with an ending drawMenus(); and inside of script tags.
Your page would have <body><--msnavigation-->the call for the milonic files including the menu_data.js file from which you have removed the main menu. Then down in that table you would have either the main menu itself or the call for the data file you made to hold the main menu.
Table Embedded Menus has an in depth explanation on this.
Ruth