JS-based countdown program instance and js countdown instance
This example describes the JS-based countdown program. Share it with you for your reference. The specific implementation method is as follows:
Remaining Time: <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 points"; return second;} var day = hour = ""; if (second> 86400) {day = Math. floor (second/86400) + "day"; second = second % 86400;} if (second> 3600) {hour = Math. floor (second/3600) + "Hour"; second = second % 3600;} if (second> 60) {min = Math. floor (second/60) + "Minute"; second = second % 60;} second = 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>
I hope this article will help you design javascript programs.