/*
Time Countdown Plugin
Timedown.js
*/
function Timedown (ID, enddatestr) {
End time
var endDate = new Date (ENDDATESTR);
Current time
var nowdate = new Date ();
Total number of seconds in difference
var totalseconds = parseint ((enddate-nowdate)/1000);
Days
var days = Math.floor (TotalSeconds/(60 * 60 * 24));
Modulo (remainder)
var modulo = totalseconds% (60 * 60 * 24);
Number of hours
var hours = Math.floor (modulo/(60 * 60));
modulo = modulo% (60 * 60);
Minutes
var minutes = Math.floor (MODULO/60);
Seconds
var seconds = modulo% 60;
Output to Page
document.getElementById (id). InnerHTML = "Still left:" + days + "Day" + Hours + "hours" + minutes + "minutes" + seconds + "seconds";
Delay one second to execute yourself
SetTimeout (function () {
Timedown (ID, ENDDATESTR);
}, 1000)
}
-----------------------------------------------------------------------------
<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Time Countdown </title>
<script src= "Timedown.js" ></script>
<body>
<form id= "Form1" runat= "Server" >
<div id= "Show" >
</div>
<script type= "Text/javascript" >
Timedown ("Show", "2013-11-25 8:00:45");
</script>
</form>
</body>
JS Time Countdown---Excerpt others--collection