Share via


setTimeout method

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

Evaluates an expression after a specified number of milliseconds has elapsed.

Syntax

long retVal = object.setTimeout(expression, msec);

Standards information

There are no standards that apply here.

Parameters

  • expression [in]
    Type: VARIANT

    Pointer to a VARIANT that specifies the 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.

Remarks

The specified expression or function is evaluated once. For repeated evaluation, use the setInterval or setInterval 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 setInterval.

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

As of Internet Explorer 5, the first argument of setTimeout can be a string or a function pointer.

See also

clearTimeout

 

 

Build date: 1/26/2012