About setinterval: What if you click the setinterval button again without refreshing the page?

Source: Internet
Author: User

The Imitation tutorial provides a countdown page with the following code:

 

1 <HTML> 2 

 

However, an interesting phenomenon is found during running:

Because the above Code does not hide the input box and the countdown button after the countdown starts, this leads to a new countdown button if you do not click the new page after the countdown starts, the following countdown will start again, but the speed of the countdown will be twice the original speed, and the click will be twice the last time, and so on. It means that if you click the Start countdown button again without refreshing a new page, the countdown function is called twice in 1000 milliseconds;

About setinterval: What if you click the setinterval button again without refreshing the page?

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.