_javascript technique of Jump prompt page based on javascript

Source: Internet
Author: User

First show you the effect of the picture, if you feel good, please refer to the implementation code:

Web page Layout

<p> operation Success </p>
<strong>5</strong><span> seconds back to homepage </span><a href= "javascript : History.back (); > Return </a>

Task:

1. After opening the page, if you do not do anything to return to a new page

var num=document.getelementsbytagname ("Strong") [0].innerhtml;
Gets the element that displays the number of seconds, changing the number of seconds by the timer.  
function count () {
num--;
document.getElementsByTagName ("Strong") [0].innerhtml=num;
if (num==0) {
location.assign ("www.imooc.com");
}
SetInterval ("Count ()", 1000);

2. Click Back to return to the previous page

function Backto () {
window.history.back ();
}

Location and history are objects in the window

The Location.assign () method is used to load a new document

The History.back () method can load the previous URL in the history list

The above is a small set for you to introduce the JavaScript based on the implementation of the Jump tips page, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.