zoukankan      html  css  js  c++  java
  • 验证码倒计时

    验证码倒计时

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3     <title>验证码倒计时</title>
     4     <script src="http://code.jquery.com/jquery-latest.js"></script>
     5     <style>
     6         .zc_submit {
     7             height: 35px;
     8             line-height: 35px;
     9             background: #AA0000;
    10             display: block;
    11             width: 152;
    12             color: #FFFFFF;
    13             font-size: 0.8em;
    14             text-align: center;
    15             box-shadow: inset 0 0 1px #AA0000;
    16             border: 0px solid #AA0000;
    17             box-sizing: border-box;
    18         }
    19     </style>
    20     <script type="text/javascript">
    21         var wait = 5;
    22         function SendCode() {
    23             if (wait == 5) { time(); GetSmsCode(); }
    24             else { };
    25         }
    26         function time() {
    27             var $ALink = $("#Getcode");
    28             if (wait == 0) {
    29                 $ALink.css('background-color', '#AA0000');
    30                 document.getElementById("Getcode").innerHTML = "获取验证码:";
    31                 $ALink.click(function () {
    32                     SendCode();
    33                 });
    34                 wait = 5;
    35             } else {
    36                 $ALink.css('background-color', '#666666');
    37                 document.getElementById("Getcode").innerHTML = wait + "秒后重新获取";
    38                 wait--;
    39                 setTimeout(function () {
    40                     document.getElementById("Getcode").onclick = function () {
    41                         return false;
    42                     }
    43                     time();
    44                 },
    45                 1000)
    46             }
    47         }
    48     </script>
    49 
    50 </head>
    51 <body>
    52     <a class="zc_submit" herf="#" id="Getcode" onclick="SendCode();" style="152px">获取验证码:</a>
    53     <input name="code" id="code" type="text" placeholder="短信发送可能因运营商网络会延迟3-5分钟">
    54 </body>
    55 </html>
    View Code
  • 相关阅读:
    shell脚本while read line的使用
    shell 一次性赋值多个变量
    Docker Volume
    nginx反向代理与负载均衡
    lua中 table.getn(t) 、#t、 table.maxn(t) 这三个什么区别?
    pv绑定pvc
    使用brew services管理服务
    Kubernetes中强制删除Pod、namespace
    shell 中的${},##, %% , :- ,:+, ? 的使用
    petalinux中fsbl源码
  • 原文地址:https://www.cnblogs.com/itslives-com/p/IdentifyingCodeForSetTimeou.html
Copyright © 2011-2022 走看看