JavaScript countdown to next New Year's day, often used for online shop limited time sales

Source: Internet
Author: User
<div> How long is the next New Year's Day: </div><div id= "Timer" ></div><script type= "Text/javascript" > function Nexttime () {var now = new Date ();//How long is the next New Year's Day? var end = new Date (now.getfullyear () + 1,0,1);//two time difference var time = end. GetTime ()-now.gettime ();//Convert to seconds var sec = time/1000;//Convert all day var day = Math.floor (SEC/60/60/24);//Convert to var hour = sec/60/60;/ /conversion ingredient var min = Sec/60;var Lhour = Math.floor (hour%); var lmin = math.floor (min%); var lsec = Math.floor (sec);d O Cument.getelementbyid ("Timer"). InnerHTML = day + "Days" + Lhour + "when" + lmin + "min" + lsec + "SEC";} SetInterval (nexttime,1000);</script>

  

  

JavaScript countdown to next New Year's day, often used for online shop limited time sales

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.