JavaScript implementation time countdown jump (recommended) _javascript tips

Source: Internet
Author: User
Tags setinterval

1. The settimeout () method is used to call a function or evaluate an expression after a specified number of milliseconds.

SetTimeout () executes only one code at a time. If you want to call more than once, use SetInterval () or let code itself call SetTimeout () again.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 
 
 

The 2.setInterval () method can call a function or a calculation expression in the specified period (in milliseconds).

The SetInterval () method keeps calling the function until the clearinterval () is called or the window is closed. The ID value returned by SetInterval () can be used as an argument to the Clearinterval () method.

 
 

below to introduce you to the relevant reading

The 1.setInterval () function can refer to the SetInterval () section of the functional usage.

2.location.href can refer to the HREF attribute section of the Location object.

The 3.innerHTML attribute can refer to the usage section of the innerHTML property of JS.

The following example (example) to introduce you:

 
 

The problems encountered:

When the above JS method is placed on the $ (function () {...}) , the browser will report METHODXX () is not defined;

The definition of function () {} should be placed in <script></script>

The above is a small set to introduce the JavaScript implementation time countdown jump (recommended), 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!

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.