Pause execution in JavaScript

By: Dave Reed Emailed: 1677 times Printed: 2158 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 )
List of Keywords and reverved words in Javascript
Show how many characters remaining in a html text box using javascript
Typecasting in Javascript
Click to remove an element from a select html form using javascript
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
Bitwise NOT, AND, OR, XOR operators in Javascript
Password protect a web page using Javascript
Using ! and !! in Javascript
Getting Browser's height and width using Javascript
History and evolution of Javascript
Using toString() in JavaScript to convert data types to String
Using && in Javascript
do-while, while, for and for-in loops in Javascript
break and continue in Javascript
Math object and Math functions in Javascript
Most Emailed Articles (in Javascript)
List of Keywords and reverved words in Javascript
window.frames[i] in Javascript
Verifying user input in JavaScript
Typecasting in Javascript
Scrolling message on the status bar using Javascript
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
call() and apply() methods in Javascript
Form validation using Javascript
Diabling Right Click option in a browser using Javascript
Javascript to display client date and time on webpage
History and evolution of Javascript
Javascript Basics
The if statement in Javascript
do-while, while, for and for-in loops in Javascript
Password protect a web page using Javascript