码迷,mamicode.com
首页 > Web开发 > 详细

js jquery 实现点击按钮后,倒计时60秒才能再次点击发送验证码

时间:2016-03-30 09:53:37      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

 1 <input type="button" id="btn" value="免费获取验证码" />
 2 <script type="text/javascript">
 3 var wait=60;
 4 function time(o) {
 5 if (wait == 0) {
 6 o.removeAttribute("disabled");    
 7 o.value="免费获取验证码";
 8 wait = 60;
 9 } else {
10 o.setAttribute("disabled", true);
11 o.value="重新发送(" + wait + ")";
12 wait--;
13 setTimeout(function() {
14 time(o)
15 },
16 1000)
17 }
18 }
19 document.getElementById("btn").onclick=function(){time(this);}
20 </script>

 

js jquery 实现点击按钮后,倒计时60秒才能再次点击发送验证码

标签:

原文地址:http://www.cnblogs.com/dongchuang/p/5335849.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!