stone310
<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>