Home >Web Front-end >JS Tutorial >The setTimeout function is compatible with all mainstream browsers and has execution effects examples_javascript skills
Currently, this setTimeout is well compatible with IE6, 7, 8, 9, as well as Google Chrome, Firefox, Safari, and Opera.
setTimeout is a very good function. Website page front-end engineers often use it for actions that will be executed after a few seconds. The setTimeout JS built-in function is also very simple to use. The following is the function description of setTimeout(), detailed usage, examples, and sample code:
The function of setTimeout() is to specify how many milliseconds to execute a JS function or Expression code
Usage, syntax, and parameters of setTimeout: setTimeout(code,millisec)
setTimeout parameter description:
code is a required parameter. The string of JavaScript code to be executed after the function to be called.
millisec is a required parameter. The number of milliseconds to wait before executing code. The conversion between milliseconds and seconds is: 1000 milliseconds = 1 second
setTimeout example code (the page jumps to the specified URL after 1 second):