[Javascript] Pause execution for 2 seconds

Roger Roelofs rer at datacompusa.com
Thu Jan 6 19:27:59 CST 2005


Tim,

On Jan 6, 2005, at 8:07 PM, Tim Burgan wrote:

> Hello,
>
>
> I'm wondering how I can pause or hold javascript execution for 2 
> seconds.
>
> I have a web page that displays a message, then after 2 seconds I want 
> the window to close.
>
> Can someone please forward me in the right direction as to where I 
> find out how to do something like this.

This is from memory, so double-check me...

function closeWin() {
// close the window...
}

setTimeout('closeWin()', 2000);

> PS. In PHP, they have an excellent official online manual, and Java 
> has their API.. does JavaScript have a similar type of documentation?

Not that I know of.  I always just look in 'Javascript: The Definitive 
Guide'  It's a bit dated (at least my copy is :) ) but handy.

hth

Roger,

Roger Roelofs
Datacomp Appraisal Services




More information about the Javascript mailing list