Hi all,
I have some menu script that is misfiring. For some reason my onmouseout event seems to fire occasionaly when I roll onto the next item in my list.
I was thinking an easy way round this would be to put a delay on the onmouseout event:
However, I can't seem to get it to work. Here's the code:
Does anyone know what I need to do to get this working?
Thanks,
Richard
I have some menu script that is misfiring. For some reason my onmouseout event seems to fire occasionaly when I roll onto the next item in my list.
I was thinking an easy way round this would be to put a delay on the onmouseout event:
Code:
sli[x].onmouseout = function() { this.className = this.className.replace( " over", "" ); }
However, I can't seem to get it to work. Here's the code:
Code:
function showSubMenu(a) {
var ul = a.parentNode.getElementsByTagName("ul")[0];
a.className = ( a.className.indexOf(" selected")>-1 ) ? a.className.split(" selected")[0] : a.className + " selected";
ul.className = ( ul.className.indexOf(" active")>-1 ) ? ul.className.split(" active")[0] : ul.className + " active";
return false;
}
function attachEvents() {
var l = document.getElementById("nav").childNodes;
for ( var i = 0; i < l.length; i++ ) {
if ( l[i].nodeName == "LI" && hasChildList(l[i]) ) {
var a = l[i].getElementsByTagName("a")[0];
a.onclick = function() { return showSubMenu(this); };
var sl = l[i].childNodes;
for ( var y = 0; y < sl.length; y++ ) {
if ( sl[y].nodeName == "UL" && hasChildList(sl[y]) ) {
var sli = sl[y].childNodes;
for ( var x = 0; x < sli.length; x++ ) {
if ( sli[x].nodeName == "LI" && document.all ) {
sli[x].onmouseover = function() { this.className += " over"; }
sli[x].onmouseout = function() { this.className = this.className.replace( " over", "" ); }
}
}
}
}
}
}
}
function hasChildList(o) {
return o.getElementsByTagName("ul").length > 0;
}
Does anyone know what I need to do to get this working?
Thanks,
Richard