日期:2014-05-16 浏览次数:20365 次
<span id="daysLeft"></span>
<script type="text/javascript">
/*
**参数:target(目标日期),类型:string,格式:year/month/day
*/
(function tC(target){
var day=24*60*60*1000,
hour=60*60*1000,
minute=60*1000,
second=1000;
var tE=(new Date(target)).getTime(),
now=new Date(),
tN=now.getTime(),
hN=now.getHours(),
mN=now.getMinutes(),
sN=now.getSeconds();
var time=tE-tN,
_day=parseInt(time/day),
_hour=parseInt(time%day/hour),
_minute=parseInt(time%day%hour/minute),
_seconds=parseInt(time%day%hour%minute/second),
str='距离 '+target+' 还有: '+_day+'天'+_hour+'时'+_minute+'分'+_seconds+'秒';
document.getElementById('daysLeft').innerHTML=str;
setTimeout(function(){tC(target)},1000);
})('2013/12/25');
</script>