主页 > 前端 > javascript >
来源:未知 时间:2015-07-25 08:30 作者:xxadmin 阅读:次
[导读] 本文讲解javascript实现倒计时效果 剩余时间:iid=expireTime/iscripttype=text/javascriptvarexpire=2412169;varexpireTime=function(expires){if(expires0){varsecond=expires;}else{varsecond=0分;returnsecond;}varday=hour=min=;if(sec...
本文讲解javascript实现倒计时效果 剩余时间:<i id="expireTime"></i> <script type="text/javascript"> var expire = 2412169; var expireTime = function(expires){ if(expires > 0){ var second = expires; }else{ var second = "0 分"; return second; } var day = hour = min = ""; if(second>86400){ day = Math.floor(second/86400)+"天 "; second = second%86400; } if(second>3600){ hour = Math.floor(second/3600)+"时 "; second = second%3600; } if(second>60){ min = Math.floor(second/60)+"分 "; second = second%60; } second = second+"秒"; return day+hour+min+second; } var timeEle = document.getElementById("expireTime"); var timer = window.setInterval(function(){ timeEle.innerHTML = expireTime(expire--); if(expire<0){ clearInterval(timer); } },1000); </script> |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com