Two functions in a setTimeout??

Discussion in 'JavaScript' started by Jen-, Apr 11, 2007.

  1. #1
    Hello, can two functions go into a set timeout? If so how does it look and will it switch back and forth between the two functions after so much time? Please let me know, Thank you...

    setTimeout('one()','two()',3000)????????
     
    Jen-, Apr 11, 2007 IP
  2. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    umm you can do...

    
    setTimeout('one()', 3000);
    
    function one()
    {
    setTimeout('two()', 3000);
    //your code etc
    }
    
    function two()
    {
    setTimeout('one()', 3000);
    //your code etc
    }
    
    Code (markup):
    to get the affect of switching back and forth between them every 3 seconds.
     
    giraph, Apr 11, 2007 IP
  3. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Whoa, hadn't thought of that, didn't know you could do that, I'll try it thanks!
     
    Jen-, Apr 11, 2007 IP