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