setInterval() [FF, IE 4]

Executes JavaScript statements at repeated time intervals, given two parameters: the JavaScript statements to execute and the number of milliseconds between each execution. The function returns a reference to the interval so that clearInterval() may cancel it.

For example:

var the_interval = setInterval("alert('Stop procrastinating!');", 10000);

creates an interval that calls up an alert box every 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.