Click to See Complete Forum and Search --> : How to delay this function


hismightiness
07-24-2003, 02:20 PM
I have a function I have been working on and I want it to execute a couple seconds after it is called:

function showHide2(id, newClass, dispProp) {
var showID=document.getElementById(id);
showID.style.visibility=newClass;
showID.style.display=dispProp;
}

This function is called from onmouseout. Any help would be greatly appreciated.

Jona
07-24-2003, 02:37 PM
onMouseOut="var sTime = setTimeout('showHide2()', 1000);"


[J]ona

Jona
07-24-2003, 02:44 PM
Your function will need this also:


clearTimeout(sTime);


[J]ona

hismightiness
07-24-2003, 02:48 PM
Can I still pass variables with your solution?

My mouseover consists of this:

onmouseout="showHide2('cellGen2','hidden','none');"

Jona
07-24-2003, 02:51 PM
onMouseOut="var sTime = setTimeout('showHide2(\'cellGen2\', \'hidden\', \'none\'', 1000);"


[J]ona

hismightiness
07-24-2003, 03:09 PM
Ahhh... I was trying a similar thing, only with "\\" instead of "\" - DUH! Thanks a million!

Jona
07-24-2003, 03:12 PM
You're welcome.

[J]ona