<body>
<div id='res'><span id='d'></span><span id="h"></span><span id="m"></span><span id="s"></span></div>
</body>
<script src="./jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var now = new Date(); //当前时间
//2012-07-26 16:22:53
var EndTime = new Date(now.getTime()+1000*60*60*24*2); //当前时间+2天 注意 js中getTime()是以毫秒计算 所以*1000 php是以秒计算
function timer(){
now = new Date();
var t = EndTime.getTime()-now.getTime();
if(t > 0){
var s = Math.floor(t/1000)%60; //秒
var m = Math.floor(t/(1000*60))%60; //分
var h = Math.floor(t/(1000*60*60))%24; //时
var d = Math.floor(t/(1000*60*60*24)); //天
s = (s<10)? '0'+s:s;
document.getElementById("d").innerHTML=d+"天";
document.getElementById("h").innerHTML=h+"小时";
document.getElementById("m").innerHTML=m+"分";
document.getElementById("s").innerHTML=s+"秒";
}else{ //到时间后边框阴影发光
if(t % 2 == 0){
$('#res').css({"box-shadow":" 0 0 12px rgba(72, 106, 170, 0.5)","-o-box-shadow":" 0 0 22px rgba(72, 106, 170, 0.5)","-moz-box-shadow":" 0 0 12px rgba(72, 106, 170, 0.5)","-webkit-box-shadow":" 0 0 12px rgba(72, 106, 170, 0.5)","border-color":"rgba(160, 179, 214, 0.5)"});
}else{
$('#res').css({"box-shadow":"0 0 12px rgba(72, 106, 170, 1.0), 0 0 18px rgba(0, 140, 255, 1.0)","-o-box-shadow":"0 0 12px rgba(72, 106, 170, 1.0), 0 0 18px rgba(0, 140, 255, 1.0)","-moz-box-shadow":"0 0 22px rgba(72, 106, 170, 1.0), 0 0 18px rgba(0, 140, 255, 1.0)","-webkit-box-shadow":"0 0 12px rgba(72, 106, 170, 1.0), 0 0 18px rgba(0, 140, 255, 1.0)","border-color":"rgba(160, 179, 214, 1.0)"});
}
}
}
setInterval("timer()",1000);
</script>