<p class="sycode"> </p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre name="code" class="sycode"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>注册</title><h1 align="center">注册页面</h1><!-- <form name="reg" action="#" method="post" > --> </pre><div class="contentsignin">登入後複製</div></div> <table align="center" valign="middle"> <tr> <td>手机号:</td> <td><input name="mobile" type="text" id="mobile"></td> </tr> <tr> <td>密码:</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td>验证码:</td> <td><input name="idcode" type="text" id="idcode"></td> <td><input type="button" name="send" value="获取" onclick="sendSMS()"></td> </tr> <tr> <td></td> <td><input type="button" name="regster" value="注册" style="width:140px;" onclick="registerUser()"></td> </tr> </table> <!-- </form> --><script src="http://su.bdimg.com/static/superplus/js/lib/jquery-1.10.2_d88366fd.js"></script> <script type="text/javascript" language="javascript"> function registerUser() { var mobile = document.getElementById("mobile").value; var password = document.getElementById("password").value; var idcode = document.getElementById("idcode").value; if(mobile==''){ alert(" 请输入电话号码!"); return; } if(password==''){ alert(" 请输入密码!"); return; } if(idcode==''){ alert(" 请输入验证码!"); return; } $.ajax({ type:'post', url:'/rs/rs', data: JSON.stringify({"code":1,"attribute":[ {"key": "mobile", "value": mobile}, {"key": "password", "value": password}, {"key": "idcode", "value": idcode}]}), async:false, cache:false, dataType:'json', success:function(data){ if(data.errcode==0){ alert("开户成功"); } else{ alert(data.detail); } }, error:function(XMLResponse){ alert("error"); } }); } function sendSMS() { var mobile = document.getElementById("mobile").value; if(mobile==''){ window.alert(" 请输入电话号码!"); return; } $.ajax({ type:'post', url:'/rs/rs', data: JSON.stringify({"code":0,"attribute":[{"key": "mobile", "value": mobile}]}), async:false, dataType:'json', cache:false, success:function(data){ if(data.errcode==0){ alert("验证码已发送,请在"+data.detail+"s内输入"); }else if(data.errcode==1 ){ alert("别着急,验证码马上就来了"); } else{ alert("验证码发送失败"); } }, error:function(XMLResponse){ alert("error"); } }); }</script> <br>