首页 > 其他 > 详细

倒计时

时间:2014-06-18 19:49:33      阅读:277      评论:0      收藏:0      [点我收藏+]

  今天学到了一个倒计时效果,本人脑子有点慢,琢磨了半天时间。做完之后给乱码看了下,学到了 一个知识点 x|0 取x整数 ,再此感谢乱码。

  

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>leftTime</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script type="text/javascript">
    var interval = 1000;
    function countDown(year,month,day,divname){
        var nowTime = new Date();
        var endTime = new Date(year,month-1,day);
        var leftTime =endTime.getTime()-nowTime.getTime();
        var leftSecondes = parseInt(leftTime/1000);
        var day1 = leftSecondes/(60*60*24) | 0;
        var hours = (leftSecondes - day1*60*60*24 ) / 3600 | 0 ;
        var minute = (leftSecondes - day1*60*60*24 - hours*3600)/60 | 0;
        var secondes = (leftSecondes - day1*60*60*24 - hours*3600 -minute*60) | 0;
        var oDemo = document.getElementById(divname);
        oDemo.innerHTML = "距离婚纱照:"+year+"年"+month+"月"+day+"日还有 "+day1+"天"+hours+"时"+minute+"分钟"+secondes+"秒";
    }
    window.setInterval(function(){
         countDown(2014,7,25,‘demo‘)
    },interval)
</script>
</head>
<body>
    <div id="demo"></div>
</body>
</html>

 

倒计时,布布扣,bubuko.com

倒计时

原文:http://www.cnblogs.com/1989zhiyuan/p/3790619.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!