JavaScript Lifelike picture Countdown implementation code JS time picture Countdown

Source: Internet
Author: User

JavaScript Lifelike picture Countdown implementation code JS time picture Countdown

<!doctype html>. time{width:200px;height:25px;border:1px red Solid;overflow:hidden;}. Time span{float: left;line-Height:25px;height:25px;overflow:hidden;} . Time Span.danwei{padding:01px;} . Clear{height:0; Clear:both;overflow:hidden;} </style> distance launches also include:<div class= "Time" id= "time1" > <span></span> <span></span> <span></span> <span class=" Danwei ">:</span> <span></span> <span></span> <span class= " Danwei ">:</span> <span></span> <span></span> <br class=" clear "> </div> <script type=" Text/javascrIPT ">  varOvera; Overa=NewDate (2017, 01, 01, 00, 00);///number of days when time exceeds 999 hoursvarLocalnow =NewDate ();functionClock1 () {varLocal =NewDate ();varIntdiff = Overa.gettime ()-local.gettime ();if(Intdiff <= 0) {document.getElementById (' time1 '). InnerHTML = "The activity is over! ";//show end of activityreturn false;} varDay = Math.floor (Intdiff/(1000 * 60 * 60 * 24)); varhour = Math.floor (Intdiff/(+ +))-(Day * 24); varHOUR2 = Math.floor (Intdiff/(1000 * 60 * 60)); varminute = Math.floor (Intdiff/(+))-(Day *)-(Hour * 60); varSecond = Math.floor (intdiff/1000)-(Day *)-(Hour *)-(MINUTE * 60); if(Hour2 <=) hour2 = ' 0 ' +Hour2;if(Day <= 9) Day = ' 0 ' +Day ;if(HOUR2 <= 9) hour2 = ' 0 ' +Hour2;if(minute <= 9) minute = ' 0 ' +minute;if(Second <= 9) Second = ' 0 ' +second; document.getElementById (' hour_01 '). Style.margintop = (hour2.tostring (). substr (0,1)) * ( -25) + ' px '; document.getElementById (' hour_02 '). Style.margintop = (hour2.tostring (). substr (()) * ( -25) + ' px '; document.getElementById (' hour_03 '). Style.margintop = (hour2.tostring (). substr (2,1)) * ( -25) + ' px '; document.getElementById (' minute_01 '). Style.margintop = (minute.tostring (). substr (0,1)) * ( -25) + ' px '; document.getElementById (' minute_02 '). Style.margintop = (minute.tostring (). substr (()) * ( -25) + ' px '; document.getElementById (' second_01 '). Style.margintop = (second.tostring (). substr (0,1)) * ( -25) + ' px '; document.getElementById (' second_02 '). Style.margintop = (second.tostring (). substr (()) * ( -25) + ' px '; SetTimeout ("Clock1 ()", 1000); } clock1 (); </script> </body> 

JavaScript Lifelike picture Countdown implementation code JS time picture Countdown

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.