<button type="button" id='getting' onclick="time(this)" class="mui-btn text-primary" style="height: 40px;width:30%;">获取验证码</button> //倒计时 var wait = 60; function time(btnObj) { if(wait == 0) { btnObj.removeAttribute("disabled"); btnObj.textContent = "重新发送"; wait = 60; } else { btnObj.setAttribute("disabled", true); btnObj.textContent = wait + "秒"; wait--; setTimeout(function() { time(btnObj) }, 1000) } }