<div id="timer"></div>
<script type="text/javascript" language="javascript">
var endDate=new Date(2010,11,11,17,05,40)//年月日时分秒,月要减去1
(function daoJiShi()
{
var now=new Date()
var oft=Math.round((endDate-now)/1000)
var ofd=parseInt(oft/3600/24)
var ofh=parseInt((oft%(3600*24))/3600)
var ofm=parseInt((oft%3600)/60)
var ofs=oft%60
document.getElementById('timer').innerHTML='还有 '+ofd+' 天 ' +ofh+ ' 小时 ' +ofm+ ' 分钟 ' +ofs+ ' 秒'
if(ofs<0){document.getElementById('timer').innerHTML='倒计时结束!'return}
setTimeout('daoJiShi()',1000)
}())
</script>
</body>
function countDown(time) {var dates = new Date(time),
dates1 = (dates - new Date())/1000,
date = Math.floor(dates1/3600/24),
hour = Math.floor((dates1-date*24*3600)/3600),
minute = Math.floor((dates1-date*24*3600-hour*3600)/60),
second = Math.floor((dates1-date*24*3600-hour*3600-minute*60)),
con = document.getElementById('show')
con.innerHTML = '距离国庆节抢购时间还有:'+ date + '天' + hour + '时' + minute + '分' + second + '秒'
}
setInterval("countDown('2014/10/01')")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)