Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Wait for a delayed function to end to start another...


  • From: peter at brunone.com (Peter Brunone)
  • Subject: [Javascript] Wait for a delayed function to end to start another...
  • Date: Wed Jan 24 12:49:02 2007


   What about another global variable that flips before when you call setTimeout, and resets when the function actually runs?

				From: Guillaume javascript@xxxxxxxxxxxxxxxxxxxxx

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)
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.LaTech.edu/pipermail/javascript/attachments/20070124/928068c5/attachment.html