js倒计时
来源:互联网 发布:eazz拉杆箱怎么样 知乎 编辑:程序博客网 时间:2024/06/06 17:25
第一种<html><head><script type="text/javascript">var c=100000000 var tfunction timedCount(){document.getElementById('but').disabled=truec=c-1000if(c<0){document.getElementById('txt').value="game over!"return;}showTime(c)t=setTimeout("timedCount()",1000)}function stopCount(){document.getElementById('but').disabled=falsesetTimeout(c,0);clearTimeout(t);}function resetCount(){stopCount();c=100000000showTime(c)}function showTime(nMS){ var nD = Math.floor(nMS/(1000 * 60 * 60 * 24)); var nH = Math.floor(nMS/(1000*60*60)) % 24; var nM = Math.floor(nMS/(1000*60)) % 60; var nS = Math.floor(nMS/1000) % 60; if (nS<10)nS ="0" +nS document.getElementById('txt').value=nH+":"+nM+":"+nS; } </script></head><body><form><input type="button" value="开始计时!" onClick="timedCount()" id="but"><input type="button" value="停止计时!" onClick="stopCount()"><input type="button" value="重置计时!" onClick="resetCount()"><input type="text" id="txt"></form></body></html>第二种var EndTime = new Date('${groupon.endTime}');var NowTime = new Date();var nMS = EndTime.getTime() - NowTime.getTime();$(document).ready(function(){if(nMS>1000){window.setInterval(showTime,1000);}else{$("#ctcontent").text("已过期!");}// setTimeout("showTime()",1000); });function showTime(){debuggernMS = nMS - 1000;var nD = Math.floor(nMS/(1000 * 60 * 60 * 24));var nH = Math.floor(nMS/(1000*60*60)) % 24;var nM = Math.floor(nMS/(1000*60)) % 60;var nS = Math.floor(nMS/1000) % 60;$("#ctday").text(nD);$("#cttime").text(nH+":"+nM+":"+nS);}
0 0
- js 倒计时
- 倒计时js
- 倒计时js
- JS倒计时
- js 倒计时
- js 倒计时
- js倒计时
- js 倒计时
- JS倒计时
- js 倒计时
- js倒计时。
- js倒计时
- js倒计时
- JS倒计时
- JS倒计时
- js倒计时
- js 倒计时
- js倒计时
- Calendar日历类型
- appium跑一个小demo
- Android静态工具类ToastUtil因为传入content不当导致Activity内存泄露
- maven的优势
- XML 解析-GData
- js倒计时
- 1.学习1: 埃拉托色尼筛选法(求一定范围内的质数)
- 寻找大小为n的数组中出现次数超过n/2的那个数
- Windows Driver Kit Version 7.1.0下载地址
- html语义化
- TortoiseSVN客户端重新设置用户名和密码
- linux tr命令详解
- UITextField 基础篇
- Linux 定时任务