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

javascript not working in IE


Poster: Maz
Dated: Wednesday December 31 2003 - 0:19:03 GMT

This causes the menu not to show in IE only.
What can I do?


Code:
aI("text=Rate;showmenu=rate;status=rate;");
if( userIsMember){
aI("text=MemberĀ Area;showmenu=memberarea;status=member area;");
}
else{
aI("text=Members;showmenu=memberlogin;status=members login;");
}
}


Header background color no longer covers background image.

Thanks
maz


Poster: Ruth
Dated: Wednesday December 31 2003 - 1:28:51 GMT

I didn't get the menu in NN 6 either, both ie and nn say 'userIsMember" is undefined. Whatever that means


Poster: kevin3442
Dated: Wednesday December 31 2003 - 1:44:59 GMT

Hi Maz,

How and where are you setting the userIsMember javascript variable? Is this on your www link, or do you have a test page we could see?

Kevin


Poster: Maz
Dated: Wednesday December 31 2003 - 3:14:08 GMT

Hi Kevin,

Its on the template, and I removed the tools menu, now I only have a top menu. I removed the js so we could both work. But UK's asleep now so I'll put it back up with the js on the www link.

Is there another way to do the if else, I think IE is fussy.

Thanks,
maz


Poster: kevin3442
Dated: Wednesday December 31 2003 - 3:48:53 GMT

Hi Maz,

Right now at least, the main problem is that the userIsMember variable is undefined (doesn't exist) when the if/else in xtopmenu.js is processed. This isn't peculiar to IE; it'll fail in any browser. userIsMember is undefined when the if/else is processed in xtopmenu.js because of the following in the generated html:
Code:
<script language="javascript" src="/template/main/xtopmenu.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
//<![CDATA[
var userIsMember;
//]]>
</script>

...the script that declares userIsMember is below where you load xtopmenu.js. Scripts are processed top-down, so userIsMember isn't declared until after it is needed in the xtopmenu.js code. Try this instead:
Code:
<script language="javascript" type="text/javascript">
//<![CDATA[
var userIsMember;
//]]>
</script>
<script language="javascript" src="/template/main/xtopmenu.js" type="text/javascript"></script>

Another potential problem I'll mention is that userIsMember is declared, but isn't assigned a starting value. I assume that when a person first visits the sight, he or she is not logged in (and so, is treated as not a member by default). To be complete, you might want to assign a default value of 0 (or false) to userIsMember when you declare it, like so:
Code:
var userIsMember = 0;

When a user selects the option to log in from the menu, I assume the login will regenerate the page (is it a php script?), setting userIsMember = 1. Again, userIsMember must be set before the menu script.

Hope that helps,

Kevin


Poster: Maz
Dated: Wednesday December 31 2003 - 4:13:57 GMT

Thanks Kevin,

Its working again, it kept working in Safari but not other browsers. I messed up moving the menu in and out of tables.

Now even more so I need border-bottom on the main menu because I want the background to be transparent. I have no problem getting a border but I get 2 bottom borders due to submenu and subimage.

I've thought of using a bgimage but I can't position it bottom, an image wouldn't stretch with text.

Is there another way of putting style in the menu, like
offclass="bottom-border\"4px solid #ccc\";

Although if you try something like that you do get 2 borders on the main menu with a submenu subimage.

Thanks again,
maz