Summary of various page timed jump (Countdown jump) Codes

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.