<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
window.onload=function(){
var send=document.getElementById('send'),
times=10,
timer=null;
send.onclick=function(){
timer=setInterval(
changeText
,1000);
}
function changeText(){
if(times<=0){
clearInterval(timer);
timer=null;
times=10;
send.value="SB继续验证";
send.disabled=false;
return;
}
else{
times--;
send.value=times+"秒后重试";
send.disabled=true;
}
}
}
</script>
</head>
<body>
<input type="button" id="send" value="发送验证码">
</body>
</html>