Currently this settimeout can be well compatible with ie6,7,8,9 as well as Google browser Chrome, Firefox firefox, Apple browser Safari,opera.
SetTimeout is a very good function, Site page front-end engineers often use it for a few seconds after the execution of the action. settimeout This JS built-in function is also very simple to use, the following is the settimeout () function description and usage details and examples, sample code:
The role of settimeout () is to specify how many milliseconds to execute a JS function or expression code
settimeout usage, syntax, parameters: settimeout (code,millisec)
SetTimeout parameter Description:
Code is a required parameter. The JavaScript code string to execute after the function to be invoked.
Millisec is a required parameter. The number of milliseconds to wait before executing the code. The conversion between milliseconds and seconds is: 1000 milliseconds = 1 seconds
SetTimeout Instance Code (page jumps to the specified URL after 1 seconds):
Copy Code code as follows:
<script language= "JavaScript" >
function Go () {//define Functions
Window.location= "main.html";//Page jump
}
Window.settimeout ("Go ()", 1000);//1 seconds to execute function go
</script>
But the above JS code is not compatible with Firefox, this is mainly because IE and Firefox browser engine is different. Let this section of the page Jump JS code compatible with IE, Firefox, SAFARI, OPERA:
Copy Code code as follows:
<script language= "JavaScript" >
function Go () {//define Functions
Window.location= "main.html";//Page jump
}
Window.settimeout (function () {go ()},1000);//1 seconds to execute functions go
</script>