setInterval Method Sample

The setInterval method invokes a function or line of code every time the specified amount of time passes. In this sample, a function is called to update the innerHTML property of a span with the current time every 1000 milliseconds, or every second. Click Start Interval to invoke the setInterval method. Click Stop Interval to remove the interval with the clearInterval method.

Interval Stopped




[Right-click and choose View Source from the shortcut menu.]

(C) 2007 Microsoft Corporation. All rights reserved. Terms of use.