Results 1 to 2 of 2

Thread: sleep function??

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Posts
    843

    sleep function??

    is there anything like a sleep function in JavaScript ??? Thank you
    "The difference between mad and genius is the success"

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Hi,

    Theres a setTimeout function which works similar to a sleep function but you have to call a function when the time elapses...

    Code:
    function sleep(maximumtim){
      setTimeout('endSleep()',maximumtim);
    }
    
    function endSleep(){
      // code at end ;
    }
    Call it like this...

    sleep(5000); will stop for 5 seconds


    Hope this helps
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width