如题所叙
1 回答
已采纳
stone310
TA贡献361条经验 获得超191个赞
<body> <div id="div"></div> <script type="text/JavaScript"> var div = document.getElementById("div") setInterval(function () { var nowTime = new Date().getTime(); var targTime = new Date("2017/01/01/00:00:00").getTime(); var allSec = (targTime - nowTime) / 1000; var day = parseInt(allSec / (3600 * 24)); var hour = parseInt(allSec / 3600 % 24); var min = parseInt(allSec / 60 % 60); var sec = parseInt(allSec % 60); div.innerHTML = "还剩下:" + day + "天" + hour + "小时" + min + "分钟" + sec + "秒 " }, 1000) </script> </body>
添加回答
举报
0/150
提交
取消