admin 发表于 2015-7-30 12:03:19

倒计时

<body>
<div id="timer"></div>
<script type="text/javascript" language="javascript">
var endDate=new Date(2015,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+ ' 分钟!';
if(ofs<0){document.getElementById('timer').innerHTML='德顺秒赞网提醒您:本活动已结束!';return;};
setTimeout('daoJiShi()',1000);
}());

</script>
</body>
页: [1]
查看完整版本: 倒计时