获取验证码短信倒计时
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<title>倒计时</title>
<head>
</head>
<body>
<input type="button" value="获取验证码" id="getCheckNum"/>
<script type='text/javascript'>
var wait = 60;
var Bvalue = document.getElementById("getCheckNum");
function changetime() {
if (wait == 0) {
Bvalue.disabled = 0;
Bvalue.value = "重新获取";
wait = 60;
}
else {
Bvalue.disabled = 1;
Bvalue.value= "已发送("+ wait + "s)";
wait--;
setTimeout(function() { changetime(); }, 100);
}
}
Bvalue.onclick = function(){
changetime();
};
</script>
</body>
</html>

学习是一个不断抄袭和重复的过程.

浙公网安备 33010602011771号