|
倒计时时钟body,div{margin:0;padding:0;}body{color:#fff;font:16px/1.5\5fae\8f6f\96c5\9ed1;}#countdown{width:300px;text-align:center;background:#1a1a1a;margin:10pxauto;padding:20px0;}input{border:0;width:283px;height:50px;cursor:pointer;margin-top:20px;background:url(img/btn-1.png)no-repeat;}input.cancel{background-position:0-50px;}span{color:#000;width:80px;line-height:2;background:#fbfbfb;border:2pxsolid#b4b4b4;margin:010px;padding:010px;}<script>window.onload=function(){ varoCountDown=document.getElementById("countdown"); varaInput=oCountDown.getElementsByTagName("input")[0]; vartimer=null; aInput.onclick=function() { this.className==""?(timer=setInterval(updateTime,1000),updateTime()):(clearInterval(timer)); this.className=this.className==''?"cancel":''; }; functionformat(a) { returna.toString().replace(/^(\d)$/,'0$1') } functionupdateTime() { varaSpan=oCountDown.getElementsByTagName("span"); varoRemain=aSpan[0].innerHTML.replace(/^0/,'')*60+parseInt(aSpan[1].innerHTML.replace(/^0/,'')); if(oRemain |