window.setInterval()

JavaScript1.2+, JScript3.0+ Nav4+, IE4+ Syntax

							window.setInterval(expression, milliseconds)
							window.setInterval(function, milliseconds)
							window.setInterval(function, milliseconds, arg1, …, argN)
						

Description

The setInterval() method of the Window object sets an interval to invoke the expression or function that is passed to the method. The expression or function is invoked after every elapse of the milliseconds passed. As shown in the syntax definition, it is possible to pass arguments to the function you want to invoke. This interval can be cleared by using the clearInterval() method.

Example

Listing 7.583 sets an interval in the <head> of the document that displays the current time in a text box on the page. The ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.