Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
setInterval
Collapse the table of content
Expand the table of content

setInterval method

Evaluates an expression each time a specified number of milliseconds has elapsed.

Syntax


 retVal = object.setInterval(expression, msec, language);

Parameters

expression [in]

Type: VARIANT

Pointer to a VARIANT that specifies a function pointer or string that indicates the code to be executed when the specified interval has elapsed.
msec [in]

Type: long

long that specifies the number of milliseconds.

language [in, optional]

Type: VARIANT

Pointer to a BSTR that specifies any one of the possible values for the IHTMLElement::language attribute.

Standards information

There are no standards that apply here.

Remarks

The IHTMLWindow3::setInterval method continuously evaluates the specified expression until the timer is removed with the IHTMLWindow2::clearInterval method.

Note  In Windows Internet Explorer, you cannot pass arguments to the callback function directly; however, you can simulate passing arguments by creating an anonymous closure function that references variables within scope of the call to IHTMLWindow3::setInterval or IHTMLWindow3::setTimeout. For more information, see Examples.

In versions earlier than Microsoft Internet Explorer 5, the first argument of IHTMLWindow3::setInterval must be a string. Evaluation of the string is deferred until the specified interval elapses.

As of Internet Explorer 5, the first argument of IHTMLWindow3::setInterval can be passed as a string or as a function pointer.

See also

Reference
IHTMLWindow2::clearInterval
requestAnimationFrame
IHTMLWindow3::setTimeout
setImmediate

 

 

Community Additions

ADD
Show:
© 2015 Microsoft