跑起来了啊
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>发送验证码</title>
<script type="text/javascript">
window.onload=function(){
var send=document.getElementById('send'),
times=60,
timer=null;
send.onclick=function(){
// 计时开始
console.log(times);
send.disabled='disabled';
if(timer){clearInterval(timer);timer = null;}
timer = setInterval(function(){
times--;
send.value = times+"秒后重试";
if(times<=0){
clearInterval(timer);
times = 60;
send.disabled='';
send.value = "发送验证码";
}
},1000);
}
}
</script>
</head>
<body>
<input type="button" id="send" value="发送验证码">
</body>
</html>