View Full Version : setTimeout

03-20-2005, 06:26 AM
I'm working on a script where the divs are moved the one after the other.
I have a problem to let the synchronisation work and I would like to know if that works :
a first loop in a function with a timer, like :
for (i=0; i <condition_output; i++) {
time01 =setTimeout('theFunc(p1, i)', 1000) ;}
and then in the function
function theFunc(p1, p2) {
for (i=0; i <condition_output; i++) {
time02 =setTimeout('anotherFunc(p1, p2)', 1000) ;}

Where do I have to release the clearTimeout ? is that important ? can it work ?

Thank you by advance

03-20-2005, 01:28 PM
If you want to know if something works, then test it. ;)

Loops are probably not great for flexible queing, clearTimeout is good for resetting timed inner functions, and an OO-setup can be useful here.