JavaScript group buying, timed snapping countdown code

Source: Internet
Author: User
Tip: You can modify some of the code before running

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > <ptml> &L t;head> <title> Group Purchase, timed snapping countdown </title> <meta http-equiv= "Content-type content=" text/html; charset=gb2312 "/> <meta name=" keywords "content=" "/> <meta name=" description "content=" "/> <script Language= "JavaScript" > var TMS = []; var day = []; var hour = []; var minute = []; var second = []; function Takecount () {settimeout ("Takecount ()", 1000); for (var i = 0, j = tms.length I < J; i++) {//Count minus one tms[i] = 1000; Calculates the time of time of var days = Math.floor (Tms[i]/(1000 * 60 * 60 * 24)); var hours = Math.floor (Tms[i]/(1000 * 60 * 60))% 24; var minutes = Math.floor (Tms[i]/(1000 * 60))% 60; var seconds = Math.floor (Tms[i]/1000)% 60; if (days < 0) days = 0; if (Hours < 0) hours = 0; if (minutes < 0) minutes = 0; if (seconds < 0) seconds = 0; Inserts the time and minutes into the HTML document.getElementById (Day[i]).InnerHTML = days; document.getElementById (Hour[i]). InnerHTML = hours; document.getElementById (Minute[i]). InnerHTML = minutes; document.getElementById (Second[i]). InnerHTML = seconds; } settimeout ("Takecount ()", 1000); </script> </pead> <body> <div > remaining time: <span id= "D1" >0</span> <span> Day ;/span><span id= "H1" >0</span> <span> hours </span><span id= "M1" >0</span> < span> </span><span id= "S1" > 0</span> <span> sec </span></div> <script type= " Text/javascript "> Tms[0] =" 172800000 "; Day[0] = "D1"; Hour[0] = "H1"; Minute[0] = "M1"; Second[0] = "S1"; </script> <div > remaining time: <span id= "D2" >0</span> <span> day </span><span id= "H2" & gt;0</span> <span> hr </span><span id= "m2" >0</span> <span>-</span>< span id= "s2" > 0</span> <span> sec </span></div> <script type= "Text/javascript" > Tms[1] = "1689353433455"; DAY[1] = "D2"; HOUR[1] = "H2"; Minute[1] = "M2"; SECOND[1] = "S2"; </script> </body> </ptml> </td> </tr> </table>
Tip: You can modify some of the code before running
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.