[Javascript] Wait for a delayed function to end to start another...
Guillaume
javascript at webdesignofficina.com
Wed Jan 24 12:31:56 CST 2007
I have two functions showing / hiding layer, each one with a different
delay.
Each function is fired with it's individual link: Show ( ShowDelayed() )
// Hide ( HideDelayed() )
How do I avoid these function of running together, at the same time, if
a user clicks alternatively on the two links for example...
Each function should first end before the other one starts running...
I have to achieve this inside the script and can't use a delayed onclick
for example...
Don't know if this is clear... Have a rough example below...
Regards,
Guillaume
var HideChk = false;
function Hide() {
if (HideChk) return;
HideChk = true;
var opts1 = document.getElementById("options");
opts1.style.display = "none";
}
function HideDelayed() {
setTimeout('Hide()',6000)
}
var ShowChk = false;
function Show() {
if (ShowChk) return;
ShowChk = true;
var opts1 = document.getElementById("options");
opts1.style.display = "block";
}
function ShowDelayed() {
setTimeout('Show()',3000)
}
More information about the Javascript
mailing list