zoukankan      html  css  js  c++  java
  • js短信验证码

    短信验证码,无注释,url顺便写的错的,所以会报错

     1 <!DOCTYPE html>
     2 <html>
     3     <head>
     4         <meta charset="UTF-8">
     5         <title>短信验证码 </title>    
     6     <script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
     7     <style>
     8         .sign_call span,input,p{
     9             float: left;
    10         }
    11     </style>
    12     </head>
    13         <body>
    14     <div class="sign_call">
    15         <span>验证码:</span>
    16         <input type="text" placeholder="请输入短信验证码" />
    17         <p onclick="">
    18             <span id="btn" onclick="thetime(this.id)">获取验证码</span>
    19         </p>
    20     </div>
    21     <script>
    22         function thetime(p){
    23             var wait = 60;  
    24              document.getElementById(p).disabled = false;  
    25               function time(o) {  
    26                 if (wait == 0) {  
    27                        o.removeAttribute("disabled");  
    28                        o.innerHTML = "重新获取验证码";  
    29                        wait = 60;  
    30                        o.setAttribute("onclick","thetime(this.id)");
    31                 } else {  
    32                        o.setAttribute("disabled", true);  
    33                        o.removeAttribute("onclick");
    34                        o.innerHTML = wait + "秒后重新获取";  
    35                        wait--;  
    36                        setTimeout(function () {  
    37                            time(o)  
    38                        },1000)  
    39                 }  
    40             }
    41             time(document.getElementById(p));
    42             var mobile = document.getElementById('btn').value;
    43 
    44             $.ajax({
    45                 type: "POST",
    46                 url: "http://che.anet.cn/index.php/Ios/UserTest/ajaxtest",
    47                 data: 'mobile='+mobile,
    48                 dataType: 'json',
    49                 success: function(msg){
    50                       if(msg.status == 1){
    51                            alert(msg.content); 
    52                     }else{
    53                         alert(msg.content);                  
    54                     }
    55                 } 
    56             });
    57 
    58         }
    59 
    60     </script>
    61 </body>
    62 </html>
    View Code

    正在练习,可能有错误

  • 相关阅读:
    (原)ubuntu16在torch中使用caffe训练好的模型
    (原)Ubuntu16中卸载并重新安装google的Protocol Buffers
    (原)lua提示cannot load incompatible bytecode
    (原)ubuntu上安装nvidia及torch的nccl
    Ubuntu修改grub菜单引导选项和等待时间
    Servelet 简介
    JAVA JUC 线程池
    JAVA JUC synchronized 锁的理解
    JAVA JUC 读写锁
    JAVA JUC 线程按顺序执行
  • 原文地址:https://www.cnblogs.com/wangduojing/p/6897949.html
Copyright © 2011-2022 走看看