JavaScript 简单计时器
最近工作中需要做一个活动倒计时的效果,代码很简单,做个记录 <!DOCTYPE html> <html> <head> <title>Countdown</title> </head> <body> <h1 id="tick">00:00:00</h1> <script> var handler = setInterval(function() { updateTick(document.querySelector('#tick'), handler) }, 1000); function updateTick(ele, handler) { var start = new Date(1468242903875), end = new Date(); var d = end - start, h = Math.floor((d ...