The following is a summary of the implementation of regular page Jump (also called countdown jump). Various timed jump code records are as follows:
(1) Use the setTimeout Function to implement timed jump (the following code should be written in the body area)
Copy codeThe Code is as follows:
<Script type = "text/javascript">
// Jump to the specified page 3 seconds later
SetTimeout (window. location. href = 'HTTP: // www.baidu.com ', 3 );
</Script>
(2) html code implementation. Add the following code to the header area of the page:
Copy codeThe Code is as follows:
<! -- Jump to the specified page in 5 seconds -->
<Meta http-equiv = "refresh" content = "5; url = http://www.baidu.com"/>
(3) It is a little complex, most often seen in timed jump after login
Copy codeThe Code is as follows:
<! Doctype html>
<Head>
<Meta charset = UTF-8 "/>
<Title> js page Jump method </title>
</Head>
<Body>
<Script>
Var t = 10; // set the jump time
SetInterval ("refer ()", 1000); // 1 second scheduled startup
Function refer (){
If (t = 0 ){
Location = "http://www.baidu.com"; // # Set the jump URL
}
Document. getElementById ('show '). innerHTML = "" + t + "seconds later, jump to Baidu"; // display countdown
T --; // counter decrease
// This article