SOURCE

console 命令行工具 X clear

                    
>
console
    var wait=60;
    function time(o) {
        if(wait==0){
            o.removeAttribute('disabled');
            o.value='获取验证码';
            wait=60;
        }else {
            o.setAttribute('disabled',true);
            o.value='('+wait+')s再获取';
            wait--;
            setTimeout(function () {
                time(o);
            },1000);
        }
    }
document.getElementById('btn').onclick=function () {
    time(this);
}
	<input type="button" id="btn" value="免费获取验证码" />
button{
	border:1px solid #ccc;
	cursor:pointer;
  display:block;
  margin:auto;
  position:relative;
  top:100px;
}