js 短信倒计时60s
2018-06-24 00:26:12来源:未知 阅读 ()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
#getCode {
width: 9rem;
height: 3rem;
line-height: 3rem;
font-size: 1.2rem;
background-color: #3a3a3a;
color: #fff;
border-radius: 0.8rem;
border: none;
text-align: center;
}
#getCode[disabled] {
background-color: #B6B6B6;
}
</style>
<body>
<button id="getCode">获取验证码</button>
</body>
<script src="https://cdn.bootcss.com/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function() {
//获取验证码
var getCode = document.getElementById('getCode');
var wait = 60;
function time(btn) {
if (wait === 0) {
btn.removeAttribute("disabled");
btn.innerHTML = "获取验证码";
wait = 60;
} else {
btn.setAttribute("disabled", true);
btn.innerHTML = wait + "秒后重试";
wait--;
setTimeout(function() {
time(btn);
}, 1000);
}
}
getCode.onclick = function() {
time(this);
};
})
</script>
</html>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:Vue路由vue-router
- js发送短信倒计时的简单实现方法 2019-11-12
- 传入指定时间戳开始倒计时 2019-05-08
- 倒计时5S秒自动关闭弹窗 2019-01-21
- 倒计时缓存时间问题总结 2019-01-10
- js 倒计时跳转 2018-12-24
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
