倒计时到2秒 就没了,求解
<!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(){
//计时开始
timer = setInterval(function(){
send.value = times + "秒后重试";
send.setAttribute('disabled','disabled');
times--;
if(times <= 0){
send.value = "发送验证码";
send.removeAttribute('disabled');
clearInterval(timer);
times = 60;
}
},1000);
}
}
</script>
</head>
<body>
<input type="button" id="send" value="发送验证码"/>
</body>
</html>没有1秒后重试,而是直接跳到发送验证码,这是什么情况,是哪里有问题呢,求解一下。