倒计时
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<script src="jquery.min.js"></script>
</head>
<body>
<input type="number" class="number">
<input type="button" class="btn" id="btn" value="获取验证码">
<script>
var obtn = document.getelementbyid("btn")
function getcode() {
var num = 30;
var timer = setinterval(function () {
num--
$(".btn").val(num+ ' 秒后重新获取');
if(num==0){
clearinterval(timer)
// debugger;
$(".btn").val("重新获取");
obtn.addeventlistener("click",getcode)
}else{
obtn.removeeventlistener('click', getcode);
}
},1000)
}
obtn.addeventlistener("click",getcode)
</script>
</body>
</html>
上一篇: 不同病原体所致支气管肺炎的特点
下一篇: 有龋齿的人要注意吃什么