/

HTML / CSS / JavaScript Tutorial

JavaScript Window method: setTimeout()

[this page | pdf | back links]

The setTimeout() method (when applied to Window objects in the JavaScript BOM) calls a function or evaluates expression (once) after a specified interval (in milliseconds).

 

It has the following syntax with the following parameters. It returns an id value (number) which is then used as the parameter for the clearTimeout() method.

 

Note: use the setInterval () method to execute the function repeatedly.

 

window.setTimeout(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)


Desktop view | Switch to Mobile