js实现button点击之后60秒后才可以再次点击
1 var wait = 60; 2 document.getElementById("btn").onclick = function() { 3 time(this); 4 } 5 function time(o) { 6 if (wait == 0) { 7 o.removeAttribute("disabled"); 8 o.innerHTML = "免费获取验证码"; 9 wait = 60; 10 } else { 11 o.setAttribute("disabled", true); 12 o.innerHTML = wait + "秒后可以重新发送"; 13 wait--; 14 setTimeout(function() { 15 time(o) 16 }, 1000) 17 } 18 }