日期:2014-05-16 浏览次数:20415 次
var wait=60; var logNum = Math.floor(Math.random() * 60 + 1); function time(o,num) { if (wait == 0) { o.removeAttribute("disabled"); o.value="再次免费获取验证码"; wait = 60; } else { o.setAttribute("disabled", true); o.value="重新发送(" + wait + ")"; if(wait==logNum){ resend(); } wait--; setTimeout(function() {time(o,wait);},1000); } } document.getElementById("btn").onclick=function(){time(this,null);} var maxtime = 60; function CountDown(){ if(maxtime>=0){ document.all["btn"].setAttribute("disabled", true); seconds = Math.floor(maxtime%60); msg = "重新发送("+seconds+")"; document.all["btn"].value = msg; --maxtime; } else{ clearInterval(timer); msg = "重新发送"; document.all["btn"].value = msg; document.all["btn"].removeAttribute("disabled"); } } timer = setInterval("CountDown()",1000);