JavaScript Realistic Picture Countdown Implementation code _ Time Date

Source: Internet
Author: User
Realistic JS picture countdown, showing the remaining hours, minutes, seconds. Only a picture is done, and pure web version of the same OH. Now use the picture simulation led effect, really good, I hope we thoroughly like OH.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title> Realistic picture Countdown </title> <meta http-equiv= "Content-type" content= "text/html;charset=gb2312" > <style type= "text/css" > 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:0 1px;} . Clear{height:0;clear:both;overflow:hidden;} </style> </pead> <body> Distance launch also: <div class= "Time" id= "time1" > <span></span> &L t;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" &Gt var Overa; Overa = new Date (2010, 10, 01, 00, 00);///number of days when the time is more than 999 hours var localnow = new Date (); function Clock1 () {var local = new Date (); var Intdiff = Overa.gettime ()-local.gettime (); if (Intdiff <= 0) {document.getElementById (' time1 '). InnerHTML = "activity is over! ";//Display activity end return false;} var day = Math.floor (Intdiff/(1000 * 60 * 60 * 24)); var hour = Math.floor (Intdiff/(1000 *))-(day * 24); var hour2 = Math.floor (Intdiff/(1000 * 60 * 60)); var minute = Math.floor (Intdiff/1000)-(Day * *)-(hour * 60); var second = Math.floor (intdiff/1000)-(* * * (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 (1,1)) * ( -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 (1,1)) * ( -25) + ' px '; document.getElementById (' second_01 '). Style.margintop = (second.tostring (). substr (0,1)) * ( -25) + ' px '; document.getElementById (' second_02 '). Style.margintop = (second.tostring (). substr (1,1)) * ( -25) + ' px '; SetTimeout ("Clock1 ()", 1000); } clock1 (); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.