短信验证码

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>短信验证码(每隔60s发送)</title>
</head>
<body>
<input type="button" class="auths" id="auths" value="获取验证码" />
<script type="text/javascript" src="js/jquery.js"></script>
<script>
var wait=60;

function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.value="获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.value="重新发送(" + wait + ")";
wait--;
setTimeout(function() {
time(o);
},
1000)
}
}

document.getElementById("auths").onclick=function(){time(this);};
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/lmh951126/p/9927407.html