Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: setTimeout

  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    setTimeout

    Hallo,
    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
    Ben

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •