Pause execution in JavaScript

By: Dave Reed Emailed: 1647 times Printed: 2115 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

This javascript pauses the execution for specifed numSeconds.
function pause(numSeconds)
// Assumes: numSeconds >= 0
// Results: pauses execution for numSeconds seconds
{
    var now, goalTime;

    now = new Date();
    goalTime = now.getTime() + 1000*numSeconds;

    while (now.getTime() < goalTime) {
        now = new Date();
    }
}

  

Javascript Home | All Javascript Tutorials | Latest Javascript Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Dave Reed
Pause execution in JavaScript
Verifying user input in JavaScript

More Tutorials in Javascript
Use WinSCP to transfer log files remotely using Javascript
Verifying user input in JavaScript
Pause execution in JavaScript
Javascript to display client date and time on webpage
Getting Browser's height and width using Javascript
Highlighting text on a page using CSS
Using revealTrans to do page transitions in Javascript
Password protect a web page using Javascript
Diabling Right Click option in a browser using Javascript
Scrolling message on the status bar using Javascript
window.frames[i] in Javascript
Form validation using Javascript
Using && in Javascript
The if statement in Javascript
do-while, while, for and for-in loops in Javascript

More Latest News
Most Viewed Articles (in Javascript )
Typecasting in Javascript
Show how many characters remaining in a html text box using javascript
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
List of Keywords and reverved words in Javascript
Using toString() in JavaScript to convert data types to String
do-while, while, for and for-in loops in Javascript
Using revealTrans to do page transitions in Javascript
Pause execution in JavaScript
Use WinSCP to transfer log files remotely using Javascript
Click to remove an element from a select html form using javascript
History and evolution of Javascript
Javascript Basics
Bitwise NOT, AND, OR, XOR operators in Javascript
Using ! and !! in Javascript
Using && in Javascript
Most Emailed Articles (in Javascript)
Javascript to display client date and time on webpage
Click to remove an element from a select html form using javascript
this keyword sample in Javascript
Getting Browser's height and width using Javascript
Bitwise NOT, AND, OR, XOR operators in Javascript
Using ! and !! in Javascript
Using revealTrans to do page transitions in Javascript
Pause execution in JavaScript
Use WinSCP to transfer log files remotely using Javascript
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
Typecasting in Javascript
Using && in Javascript
Diabling Right Click option in a browser using Javascript
Verifying user input in JavaScript
Show how many characters remaining in a html text box using javascript