Forum Moderators: open

Message Too Old, No Replies

javascript for css menu

drops seem broken on iepc

         

sldesigns

4:49 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



I don't know javascript, obviously. Can you take a look and let me know what I'm doing wrong? I suspect it's simple, but have been unable to figure this out!

My goal is a css drop down menu with only the two levels. This script works on my mac (ff, ie, safari). But my client says it isn't working on his pc (ie6, I believe)

Here are the comments:
"I especially like the drop down menus.
However, they don't seem to work quite right. I move my mouse down the list and they disappear before I can click on anything. It seems to be more prevalent on the right side of the drop down list."

<script type="text/javascript"><!--//--><![CDATA[//><!--
function menuFix() {
var sfEls = document.getElementById("navdrop").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
// event added to keep menu items from disappearing
sfEls[i].onMouseDown=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
// event added to keep menu items from disappearing
sfEls[i].onMouseUp=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp("(?¦^)sfhover\\b"), "");
}
}
}
window.onload=menuFix;
//--><!]]></script>

I can load the css and html if you like.

ps - I have this code in the head of every page on the site, since if I refer to a linked js file, ie mac won't work. I will put it as a link if it will definetely work in iepc since that is the target audience.

sldesigns

7:35 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



any microsoft-based coders know? I can't test on my mac.

appreciate your help!