D
David
Hi,
I'm trying to set a delay for an onmouseout function on a simple list menu.
I don't understand why the code below doesn't work. If on the onmouseout I
use ( this.className="hide"; ) it hides the sub menu, but if I pass it to
other functions with a setTimeout, it doesn't. Can anyone tell me what I'm
missing here?
var myFunction = function() {
var d = document.all;
var lis = document.getElementById("navmenu").getElementsByTagName("LI");
for (var i=0; i<lis.length; i++) {
lis.onmouseover=function() {
this.className="show";
}
lis.onmouseout=function() {
//this.className="hide";
doTimeout(this);
}
}
}
function doTimeout(el){
timeout = setTimeout('hideElement('+el+')',2000);
}
function hideElement(el){
el.className="hide";
}
window.onload = myFunction;
Thanks, David
I'm trying to set a delay for an onmouseout function on a simple list menu.
I don't understand why the code below doesn't work. If on the onmouseout I
use ( this.className="hide"; ) it hides the sub menu, but if I pass it to
other functions with a setTimeout, it doesn't. Can anyone tell me what I'm
missing here?
var myFunction = function() {
var d = document.all;
var lis = document.getElementById("navmenu").getElementsByTagName("LI");
for (var i=0; i<lis.length; i++) {
lis.onmouseover=function() {
this.className="show";
}
lis.onmouseout=function() {
//this.className="hide";
doTimeout(this);
}
}
}
function doTimeout(el){
timeout = setTimeout('hideElement('+el+')',2000);
}
function hideElement(el){
el.className="hide";
}
window.onload = myFunction;
Thanks, David