This is the end of the world Countdown Source code, the program has JS Controller, is used to display the countdown to the Web page, you can set the end of the world's start time, the countdown to the end of the world source code directly copy can be used, without downloading, directly can be used
<ptml> <pead> <title> Web Countdown World Doomsday Source Code _JS countdown to the end of the world _ cloud-Habitat community </title> <meta http-equiv= "Content-type "Content=" text/html Charset=utf8 "/> <script type=" Text/javascript "> Function fu_count2012 () {var days = do Cument.getelementbyid ("Countdays"); var hours = document.getElementById ("counthours"); var minutes = document.getElementById ("Countminutes"); var seconds = document.getElementById ("Countseconds"); var timetotal = new Date (); var msecondtotal = Timetotal.gettime (); var timeTotal2012 = new Date (2012,11,21,0,0,0); var mSecondTotal2012 = Timetotal2012.gettime (); var mtimes = msecondtotal2012-msecondtotal; var getdays = Math.floor (MTIMES/1000/60/60/24); var getHours = Math.floor (mtimes/1000/60/60% 24); var getminutes = Math.floor (mtimes/1000/60% 60); var getseconds = Math.floor (mtimes/1000% 60); GetHours = (GetHours < 10)? "0" +gethours:gethours; getminutes = (Getminutes < 10)? "0" +getminutes:getminutes; Getseconds = (Getseconds < 10)? "0" +getseconds:getseconds; days.innerhtml = GetDays; hours.innerhtml = getHours; minutes.innerhtml = getminutes; seconds.innerhtml = getseconds; SetTimeout ("fu_count2012 ()", 1000); } window.onload = fu_count2012; </script> <style type= "Text/css" > body {background: #000000; Color: #ffffff; Text-align:center; </style> </pead> <body> <p> distance December 31, 2012 and <span id= "Countdays" ></span> Day < Span id= "counthours" ></span> hours <span id= "countminutes" ></span> minutes <span id= "Countseconds" ></span> sec </p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Copy Code code as follows:
<div id= "Container" > From "Doomsday" and <span id= "Downtime" style= "color:red" ></span></div>
<script>
function Downtime () {
var timeout = window.settimeout (downtime, 100);
var endtime=new date ("12-21-2012 0:0:0");/change to your timing date
var today=new Date ();
var timeold= (Endtime.gettime ()-today.gettime ());
if (timeold <= 100) {
Window.cleartimeout (timeout);
document.getelementbyidx_x ("container"). InnerHTML = "It's all right, a false alarm!" ";
Return
}
var sectimeold=timeold/1000;
var secondsold=math.floor (sectimeold);
var msperday=24*60*60*1000;
var e_daysold=timeold/msperday;
var daysold=math.floor (e_daysold);
var e_hrsold= (e_daysold-daysold) *24;
var hrsold=math.floor (e_hrsold);
var e_minsold= (e_hrsold-hrsold) *60;
var Minsold=math.floor ((E_hrsold-hrsold) *60);
var e_seconds= (e_minsold-minsold) *60;
var Seconds=math.floor ((E_minsold-minsold) *60);
var decimals = Math.floor ((e_seconds-seconds) *10);
Document.getelementbyidx_x ("Downtime"). innerhtml=daysold+ "Day" +hrsold+ "Hour" +minsold+ "" +seconds+ "." +decimals+ "seconds";
}
Downtime ();
</script>