Three common methods for automatic jump of HTML pages 3 seconds later _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
In projects, we often encounter the function of automatically redirecting pages N seconds later. In fact, the method is very simple. The following section uses this article to share with you three common methods for automatic jump after the HTML page is 3 seconds, if you are interested in the knowledge about automatic jump to an html page 3 seconds later, let's take a look. In practice, we often encounter a problem: how can we automatically jump to a page N seconds later?

I have encountered problems and searched for information, and summarized three methods.

Method 1:

The simplest one: directly in frontAdd code:


The Code is as follows:



// Automatically redirects to res.html 3 seconds later. The two files belong to the same file. to jump to the jsp page, you need to enter the url address in the url ---- (the data written in the browser's address bar, for example: http: // localhost: 8080/TestDemo/1.jsp)


Method 2:

The method in window must be used:

SetTimeout calculates an expression after a specified millisecond value.

Example:


The Code is as follows:


Window. setTimeout ("alert ('hello, World')", 1000 );


This is written in js Code;

The specific implementation is as follows:


The Code is as follows:


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.