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

"'mainmenuStyle' is undefined" problem


Poster: smersch
Dated: Wednesday July 19 2006 - 7:01:45 BST

For some reason, I think my page stopped pulling up the .js files.
I have a relative menu, so the javascript for the main menu is in the HTML file. It was working fine, I rearranged some files (I'm working within frontpage--could that be a problem?) and it stopped working. I get the "'mainmenuStyle' is undefined' error after the line "style=mainmenuStyle;". If I move all the code that is in the menu_data.js file into the HTML file, I stop getting error messages, but then none of my submenus open!

I'm almost positive I have all the file directories correct:
I have all four .js files in a folder called "menu". The HTML file is in the main directory. The "menu" folder is in the main directory.

In my HTML file I have the following:

</head>
<script src="menu/milonic_src.js" type=text/javascript></script>
<script type="text/javascript">
if(parent.frames.length)top.location=document.location;
if(ns4)_d.write("<scr"+"ipt src=menu/mmenuns4.js type=text/javascript><\/scr"+"ipt>");
else _d.write("<scr"+"ipt src=menu/mmenudom.js type=text/javascript><\/scr"+"ipt>");
</script>
.
.
.
a few lines later

.
.
.
<script>
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=500;
openstyle="rtl";
orientation="vertical";
position="relative";
style=mainmenuStyle;
top=10;
aI("text=home;url=http://www.gcgcom.com/;");
aI("showmenu=about;text=about us;url=about.htm");
aI("showmenu=services;text=services;url=services.htm");
aI("showmenu=partners;text=partners;url=partners.htm;");
aI("showmenu=support;text=support;url=support.htm");
aI("showmenu=clientlogin;text=client login;url=gateway.htm");
aI("showmenu=contact;text=contact;url=contact.htm");
}

drawMenus();
</script>


pre-Thanks a million for help!


In case it matters, my menu_data.js file:

fixMozillaZIndex=true; //Fixes Z-Index problem with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps

_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=0;
_subOffsetLeft=24;

with(mainmenuStyle=new mm_style()){
align="right";
fontfamily="Verdana, Tahoma, Arial";
fontsize="10pt";
fontstyle="normal";
fontweight="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
imagepadding=6;
offbgcolor="#ffffff";
offcolor="#ACABAB";
onbgcolor="#ffffff";
oncolor="#FF6600";
outfilter="Fade(Overlap=1.00)";
padding=3;
onsubimage="menu/black_9x7right.gif";
padding=3;
pagebgcolor="#82B6D7";
pagecolor="black";
subimage="menu/grey_9x7right.gif";
subimagepadding=6;
}

with(submenuStyle=new mm_style()){
styleid=1;
bordercolor="#ACABAB";
align="right";
fontfamily="Verdana, Tahoma, Arial";
fontsize="9pt";
fontstyle="normal";
fontweight="normal";
headercolor="#000000";
imagepadding=8;
offbgcolor="#ffffff";
offcolor="#ACABAB";
onbgcolor="#ffffff";
oncolor="#FF6600";
outfilter="Blinds( Bands=1,direction=up, duration=0.3)";
overfilter="Blinds( Bands=1,direction=down, duration=0.3)";
padding=4;
separatorcolor="#ffffff";
separatorsize=1;
subimagepadding=8;
onsubimage="menu/black_9x7right.gif";
padding=3;
subimage="menu/grey_9x7right.gif";
subimagepadding=4;
}


with(milonic=new menuname("about")){
style=submenuStyle;
openstyle="rtl";
aI("text=company;url=about/about.htm");
aI("text=brochures;url=about/brochures.htm");
aI("text=5 step process;url=about/5step/consulting.htm");
aI("text=newsletter;url=about/newsletter.htm");
}

with(milonic=new menuname("services")){
style=submenuStyle;
openstyle="rtl";
aI("text=voice;url=services/voice/voice.htm");
aI("text=data;url=services/data/data.htm");
aI("text=WAN;url=services/WAN/wan.htm");
aI("text=conferencing;url=services/conferencing/conferencing.htm");
aI("text=miscellaneous services;url=services/misc/misc.htm");
}

with(milonic=new menuname("partners")){
style=submenuStyle;
openstyle="rtl";
aI("text=telecom;url=partners/partners.htm");
aI("text=miscellaneous carriers;url=partners/partners.htm");
aI("text=CPE partners;url=partners/partners.htm");
aI("text=agents;url=partners/agents.htm");
}

with(milonic=new menuname("support")){
style=submenuStyle;
openstyle="rtl";
aI("text=resources;url=support/resources.htm");
aI("text=contacts;url=support/contacts.htm");
}

with(milonic=new menuname("clientlogin")){
style=submenuStyle;
openstyle="rtl";
aI("text=login;url=gateway/gateway.htm");
aI("text=sign up;url=gateway/signup.htm");
}

with(milonic=new menuname("contact")){
style=submenuStyle;
openstyle="rtl";
aI("text=information;url=contact/contact.htm");
aI("text=feedback;url=contact/feedback.htm");
aI("text=newsletter;url=contact/newsletter.htm");
}


Poster: John
Dated: Wednesday July 19 2006 - 15:31:36 BST

I realize you've posted a lot of code, but we really need a URL so we can see how everything you've got fits together.

URL


Poster: smersch
Dated: Wednesday July 19 2006 - 16:37:03 BST

NEVER MIND. Figured it out myself. Thanks anyway for the fast response!


Poster: John
Dated: Wednesday July 19 2006 - 20:21:47 BST

Glad to hear it!


Poster: Ruth
Dated: Monday July 24 2006 - 18:29:12 BST

One thing I note, if what you posted above is correct, where is the call for you menu_data.js file? You have the calls for the milonic_src, mmenudom, mmenuns4 but no menu_data, or sub_data or whatever you called it. That's where the mainmenuStyle is defined so if you don't call that file, it can't find that style, or any of the submenus.

Nor is there a drawMenus() at the end of the file with the subs in it, and there has to be.

Ruth