setInterval method

[This documentation is preliminary and is subject to change.]

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


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

Standards information

There are no standards that apply here.


  • 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 LANGUAGE attribute.


The setInterval method continuously evaluates the specified expression until the timer is removed with the 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 setInterval or setTimeout. For more information, see Examples.

In versions earlier than Microsoft Internet Explorer 5, the first argument of 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 setInterval can be passed as a string or as a function pointer.

See also






Build date: 1/26/2012