JavaScript Window method: setInterval()
[this page | pdf | back links]
The setInterval() method (when applied to Window
objects in the JavaScript
BOM) calls a function
or evaluates an expression at specified intervals (in milliseconds). It will
continue calling the function until the clearInterval()
method is called or until the window is closed.
It
has the following syntax with the following parameters. It returns an id
value (number) which is then used as the parameter for the clearInterval()
method.
Note: use the setTimeout()
method to execute the function only once.
window.setInterval(function,
milliseconds, param1, param2, …)
|
Parameter
|
Required / Optional
|
Description
|
|
function
|
Required
|
Function to be
evaluated
|
|
milliseconds
|
Required
|
Interval (in
milliseconds) between consecutive executions (if less than 10 then defaulted
to 10)
|
|
param1, param2, …
|
Optional
|
Additional parameters
passed to function
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)