setTimeout() [FF, IE 3]

Executes JavaScript statements once after a specified amount of time, given two parameters: the JavaScript statements to execute and the number of milliseconds in the future to execute the statements. The function returns a reference to the time-out so that clearTimeout() may cancel it.

For example:

var the_timeout = setTimeout("alert('Stop procrastinating!');", 10000);

creates a time-out that calls up an alert box in 10 seconds.

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.