Name
Window.setInterval( ): periodically execute specified code — JavaScript 1.2:
Synopsis
window.setInterval(code,interval)
Arguments
-
code A function to be periodically invoked or a string of JavaScript code to be periodically evaluated. If this string contains multiple statements, they must be separated from each other by semicolons. In IE 4 (but not later versions), this argument must be a string.
-
interval The interval, in milliseconds, between invocations or evaluations of
code.
Returns
A value that can be passed to Window.clearInterval( ) to cancel the
periodic execution of code.
Description
setInterval( ) repeatedly
invokes or evaluates the function or string specified by
code, at intervals of
interval milliseconds.
setInterval( ) returns a
value that can later be passed to Window.clearInterval( ) to cancel the
execution of code.
setInterval( ) is related
to setTimeout( ). Use setTimeout( ) when you want to defer the
execution of code but do not want it to be repeatedly executed. See
Window.setTimeout( ) for a
discussion of the execution context of
code.
See Also
Window.clearInterval(
), Window.setTimeout(
)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access