Live2D

短信验证码

<!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>
posted @ 2018-11-08 09:56  林夕华  阅读(152)  评论(0编辑  收藏  举报