倒计时demo
<div class="countDown"></div> ;(function(){ var loading = (function(timer,callback){ var ele = document.querySelectorAll(".countDown")[0], t = 1000, fn = function (){ ele.innerHTML = timer / t; timer -= t; if(timer <= 1){ callback && callback(); clearInterval(hand); } }; hand = setInterval(fn,t); })(3000); }())