CSDN 倒计时小工具
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>摘自:CSDN 倒计时小工具</title>
<style>
.fc{
color:#FF0000;
}
</style>
<script type="text/javascript">
function GetDay()
{
/*---------
January —1月
February —2月
March —3月
April —4月
May —5月
June —6月
July —7月
August —8月
September —9月
October —10月
November —11月
December —12月
*/
var urodz= new Date("Nov 11,2008");
var now = new Date();
var ile = urodz.getTime() - now.getTime();
var daySeconds = 1000 * 60 * 60 * 24;
var day = Math.floor(ile / daySeconds);
ile = ile - day * daySeconds;
var hourSeconds = 1000 * 60 * 60;
var hour = Math.floor(ile / hourSeconds);
ile = ile - hour * hourSeconds;
var minuteSeconds = 1000 * 60;
var minute = Math.floor(ile / minuteSeconds);
ile = ile - minute * minuteSeconds;
var second = Math.floor(ile / 1000);
document.getElementById("divDay2").innerHTML=day;
document.getElementById("divH").innerHTML=hour;
document.getElementById("divM").innerHTML=minute;
document.getElementById("divS").innerHTML=second;
}
setInterval("GetDay();",1000);
</script>
</head>
<body>
<h4>距2008年11月11日光棍节还有 <span id="divDay2" class="fc"></span><span id="divDay1" class="fc"></span>天
<span id="divH" class="fc"></span>时<span id="divM" class="fc"></span>分<span id="divS" class="fc"></span>秒</h4>
</body>
</html>