Techs Worldwide has moved to a new location with a new name and more advanced features. Click here to visit Geeks Worldwide for technology news, tutorials, videos, tools, and discussions.
Today: 07/05/2009
 

Sleep/Pause for specified number of seconds

Use the function below to do that. Function takes number of milliseconds to sleep as argument. So, if you want to pause execution of code for 2 seconds you'll pass 2000 (2 x 1000) as argument to this function.

function javascript_sleep(milliseconds)
{
 var date = new Date();
 var curDate = null;
 do
 { 
  curDate = new Date(); 
 }while(curDate - date < milliseconds);
}

=======================================================================================

Support Geeks Worldwide:

Link to us:

You can support us by putting a link to our website on your blog or website (code is below).

<a href="http://www.techsww.com/">
Geeks Worldwide - Tutorials about Software Installation,
Configuration, Administration, Monitoring, Tools, Tips &
Tricks
</a>

OR a simple one.

<a href="http://www.techsww.com/">
Geeks Worldwide - IT related Tutorials
</a>

Feedbacks:

We appreciate feedbacks and suggestions about our tutorials and Geeks Worldwide from readers. Please contact us using the form here and let us know what you think about the tutorial and the website in general.

Bookmark Us:

We are working on new features for the website, please keep visiting or bookmark us using your favourite bookmarking service.

Subscribe to RSS:

You can subscribe to our RSS feed here.



 
Creative Commons License   Valid XHTML 1.0 Transitional Valid CSS