首页 > Web开发 > 详细

JS发送验证码读秒(转)

时间:2015-03-17 13:46:38      阅读:445      评论:0      收藏:0      [点我收藏+]
 1  <input type="button" id="btnR" value="发送验证码" class="send-a" style="border:0px;" />
 2                                                         <script type="text/javascript">
 3                                                             var wait = 60;
 4                                                             document.getElementById("btnR").disabled = false;
 5                                                             function time(o) {
 6                                                                 if (wait == 0) {
 7                                                                     o.removeAttribute("disabled");
 8                                                                     //$(o).attr("disabled", false);  jquery  
 9                                                                     o.value = "发送验证码";
10 
11                                                                     wait = 60;
12                                                                 } else {
13                                                                     o.setAttribute("disabled", true);
14                                                                     o.value = wait + "秒后,重新获取";
15                                                                     wait--;
16                                                                     setTimeout(function () {
17                                                                         time(o)
18                                                                     },
19                                                                      1000)
20                                                                 }
21                                                             }
22                                                             document.getElementById("btnR").onclick =
23                                                           function () {
24                                                               if ($(‘#txtRPhone‘).val().length > 0) {
25                                                                   sendSMS(2);
26                                                                   if (resV == 1) {
27                                                                       time(this);
28                                                                   }
29                                                               } else {
30                                                                   alert("请填写手机号");
31                                                               }
32                                                           }  
33                                                         </script>

 

JS发送验证码读秒(转)

原文:http://www.cnblogs.com/LeoMan07777/p/4343992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!