In the actual need may need to specify after the specified time to perform a function to achieve the desired purpose, which is a timer effect, just in the JS has been given such a function settimeout (), the following first introduced the second function of the
Usage:
Grammar:
Copy Code code as follows:
SetTimeout (Code,interval)
This function can specify that a specified code is executed after the specified event, and that the code executes only once.
The settimeout () function has two parameters, the first parameter sets the execution code to execute, and the second parameter sets how long it takes to execute the code, in milliseconds.
Code instance:
The above code can specify that a dialog box will pop up after 5 seconds, using the settimeout () function to run the Tishi () function after 5 seconds.
The above content is based on JavaScript to implement a certain time to perform a function of the relevant knowledge, interested friends to study together.