发送验证码倒计时
<!doctype?html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
????<title>發(fā)送驗(yàn)證碼倒計(jì)時(shí)</title>
</head>
<body>
????<input?type="button"?style="height:32px;width:120px;"?value="點(diǎn)擊發(fā)送驗(yàn)證碼"?οnclick="sendCode(this)"?/>
????<script?type="text/javascript">
????????var?clock?=?'';
????????var?nums?=?10;
????????var?btn;
????????function?sendCode(thisBtn)
????????{????
????????????btn?=?thisBtn;
????????????btn.disabled?=?true;?//將按鈕置為不可點(diǎn)擊
????????????btn.value?=?nums+'秒后可重新獲取';
????????????clock?=?setInterval(doLoop,?1000);?//一秒執(zhí)行一次
????????}
????????function?doLoop()
????????{
????????????nums--;
????????????if(nums?>?0){
????????????????btn.value?=?nums+'秒后可重新獲取';
????????????}else{
????????????????clearInterval(clock);?//清除js定時(shí)器
????????????????btn.disabled?=?false;
????????????????btn.value?=?'點(diǎn)擊發(fā)送驗(yàn)證碼';
????????????????nums?=?10;?//重置時(shí)間
????????????}
????????}
????</script>
</body>
</html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
????<title>發(fā)送驗(yàn)證碼倒計(jì)時(shí)</title>
</head>
<body>
????<input?type="button"?style="height:32px;width:120px;"?value="點(diǎn)擊發(fā)送驗(yàn)證碼"?οnclick="sendCode(this)"?/>
????<script?type="text/javascript">
????????var?clock?=?'';
????????var?nums?=?10;
????????var?btn;
????????function?sendCode(thisBtn)
????????{????
????????????btn?=?thisBtn;
????????????btn.disabled?=?true;?//將按鈕置為不可點(diǎn)擊
????????????btn.value?=?nums+'秒后可重新獲取';
????????????clock?=?setInterval(doLoop,?1000);?//一秒執(zhí)行一次
????????}
????????function?doLoop()
????????{
????????????nums--;
????????????if(nums?>?0){
????????????????btn.value?=?nums+'秒后可重新獲取';
????????????}else{
????????????????clearInterval(clock);?//清除js定時(shí)器
????????????????btn.disabled?=?false;
????????????????btn.value?=?'點(diǎn)擊發(fā)送驗(yàn)證碼';
????????????????nums?=?10;?//重置時(shí)間
????????????}
????????}
????</script>
</body>
</html>
轉(zhuǎn)載于:https://www.cnblogs.com/qhorse/p/4599200.html
總結(jié)
- 上一篇: 在 Docker 上运行一个 RESTf
- 下一篇: 第13/24周 统计信息