Mon Sep 05, 2011 11:04 pm
<html>
<script language="javascript">
function counter(){
// End date of counter down. divide by 1000 to get difference in seconds.
var expireDate = parseInt(Date.parse("Sep 14, 2014")/1000);
// Getting the current date.
var now = new Date();
var current = parseInt(now.getTime()/1000);
var secDifference = expireDate - current;
//Number of years left to expiration .
var yearsDifference = parseInt(secDifference/(60*60*24*365))
secDifference -= yearsDifference * 60 * 60 * 24 * 365;
//Number of days left to expiration .
var daysDifference = parseInt(secDifference/(60*60*24));
secDifference -= daysDifference * 60 * 60 * 24;
//Number of hours left to expiration .
var hoursDifference = parseInt(secDifference/(60*60));
secDifference -= hoursDifference * 60 * 60;
//Number of minutes left to expiration .
var minutesDifference = parseInt(secDifference/(60));
secDifference -= minutesDifference * 60;
document.getElementById("years").innerHTML=yearsDifference;
document.getElementById("days").innerHTML=daysDifference;
document.getElementById("hours").innerHTML=hoursDifference;
document.getElementById("minutes").innerHTML=minutesDifference;
document.getElementById("seconds").innerHTML=secDifference;
}
</script>
<body>
<table border="1">
<tr>
<th>Years</th>
<th> </th>
<th>Days</th>
<th> </th>
<th>Hours</th>
<th> </th>
<th>Minutes</th>
<th> </th>
<th>Seconds</th>
</tr>
<tr>
<td align="center"><span id="years"></span></td>
<td>:</td>
<td align="center"><span id="days"> </span></td>
<td>:</td>
<td align="center"><span id="hours"> </span></td>
<td>:</td>
<td align="center"><span id="minutes"> </span></td>
<td>:</td>
<td align="center"><span id="seconds"> </span></td>
</tr>
</table>
<script language="javascript">
while(true){
sleep(100)
counter();
}
function sleep(delay)
{
var startTime = new Date().getTime();
setTimeout(counter, 1000)
}
</script>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.