The window. setInterval () method can execute a program according to the specified period. The period is in milliseconds. This article introduces the definition and usage of the window. setInterval () method. If you are interested, refer
Definition and usage
The setInterval () method can call functions or computation expressions according to the specified period (in milliseconds.
The setInterval () method does not stop calling the function until clearInterval () is called or the window is closed. The ID value returned by setInterval () can be used as a parameter of the clearInterval () method.
Tip: 1000 milliseconds = 1 second.
Syntax
SetInterval (code, millisec, lang)
Parameters |
Description |
Code |
Required. The function to be called or the code string to be executed. |
Millisec |
Required. The interval between periodical execution or call codes, in milliseconds. |
Lang |
Optional. JScript | VBScript | JavaScript |
Summary:
This method can run a program according to the specified period. The cycle is in milliseconds.
If this method is not disabled or the clearInterval () method is called, it will be executed forever.
The returned value is the unique ID of this method.
To stop the execution of this timer function, see clearInterval () method 1.
Click here to see more properties and methods of window objects.
Browser support:
(1). IE browser supports this method.
(2) Firefox supports this method.
(3) operabrowser supports this method.
(4) chrome supports this method.
(5) The safria browser supports this method.
Code example:
Ant tribe