Name
setInterval( ) — NN 4 IE 4 DOM n/a
Synopsis
setInterval(expression,
msecs[, args |
language])
Starts a timer that continually invokes the
expression every
msecs. Other scripts can run in the time
between calls to expression. This method
is useful for starting animation sequences that must reposition an
element along a path at a fixed rate of speed. The
expression might be a function that moves
the element by a fixed pixel distance along one axis. The function
would be invoked at an interval set by the
msecs parameter. This method returns an ID
that should be saved as a global variable and be available as the
parameter for the clearInterval( ) method to stop
the looping timer.
Navigator and Internet Explorer diverge in the use of the third
parameter. Navigator lets you pass one or more parameters (as a
comma-delimited list in a string) for the function acting as the
expression parameter. Internet Explorer
lets you specify the scripting language of the
expression (if it is not the default
JavaScript).
Returned Value
Integer acting as an identifier.
Parameters
-
expression Any script expression as a string, but most commonly a function. The function name with parentheses is placed inside the parameter’s quoted string.
-
msecs The time in milliseconds between invocations of the
expression.-
args An optional comma-delimited list of parameters to be passed to a function used as the
expressionparameter.-
language An optional scripting language specification of the
expressionparameter (default ...
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