Html
<button class="getCode">获取验证码</button>
js
var wait=60;
function time(o){
if (wait==0) {
o.removeAttribute("disabled");
o.innerHTML="输入验证码";
o.style.backgroundColor="#fe9900";
wait=60;
}else{
o.setAttribute("disabled", true);
o.innerHTML=wait+"秒后重新获取";
o.style.backgroundColor="#8f8b8b";
wait--;
setTimeout(function(){
time(o)
},1000)
}
}
$(".getCode").click(function(){
time(this);
});