1 function tj() { 2 var phone = jQuery(‘#phone‘).val(); 3 var code = jQuery(‘#verificationcode‘).val(); 4 var password = jQuery(‘#password‘).val(); 5 var rpassword = jQuery(‘#rpassword‘).val(); 6 var type = "开户"; 7 if (phone.length == 0 || phone == ‘请输入您的手机号码‘) { 8 alert("您的手机号码不能为空!"); 9 jQuery(‘#phone‘).focus(); 10 return false; 11 } 12 if (phone.length > 0) { 13 var ab = /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/; 14 if (ab.test(phone) == false) { 15 alert("您的手机号码不正确!"); 16 jQuery(‘#phone‘).focus(); 17 return false; 18 } 19 } 20 if (code.length == 0 || code == ‘请输入手机验证码‘) { 21 alert("您的手机验证码不能为空!"); 22 jQuery(‘#verificationcode‘).focus(); 23 return false; 24 } 25 if (password.length == 0 || password == ‘请输入6-12位密码‘) { 26 alert("您的密码不能为空!"); 27 jQuery(‘#password‘).focus(); 28 return false; 29 } 30 if (password.length < 6 || password.length > 12) { 31 alert("密码为6-12位!"); 32 jQuery(‘#password‘).focus(); 33 return false; 34 } 35 if (rpassword.length == 0 || rpassword == ‘请重新输入密码‘) { 36 alert("重复密码不能为空!"); 37 jQuery(‘#rpassword‘).focus(); 38 return false; 39 } 40 if (rpassword != password) { 41 alert("两次输入密码不一致!"); 42 jQuery(‘#rpassword‘).focus(); 43 return false; 44 } 45 46 jQuery.ajax({ 47 type: "post", 48 url: "/KZH/Addkzhdata", 49 data: "phone=" + phone + "&code=" + code + "&password=" + password + "&type=" + type + "&t=" + new Date().toString(), 50 success: function (result) { 51 if (result == "0") { 52 alert("您的手机验证码不正确!"); 53 jQuery(‘#verificationcode‘).focus(); 54 return false; 55 } 56 else if (result == "1") { 57 jQuery(‘#phone‘).val(""); 58 jQuery(‘#verificationcode‘).val(""); 59 jQuery(‘#password‘).val(""); 60 jQuery(‘#rpassword‘).val(""); 61 alert("您的资料已提交,客服人员会尽快与您联系"); 62 window.location.href = "http://www.jfinfo.com"; 63 } 64 else if (result=="yes") { 65 $("#tc").show(); 66 } 67 68 }, 69 error: function (result) { 70 alert("访问出错!"); 71 } 72 }); 73 } 74 75 $(function(){ 76 $("#tc a.close").click(function(){ 77 $("#tc").hide(); 78 }) 79 }) 80 81 document.onkeydown = function (event) { 82 var e = event || window.event || arguments.callee.caller.arguments[0]; 83 if (e && e.keyCode == 13) { // enter 键 84 tj(); 85 } 86 }; 87 88 function getcode() { 89 var phone = jQuery(‘#phone‘).val(); 90 if (phone.length == 0 || phone == ‘请输入您的手机号码‘) { 91 alert("您的手机号码不能为空!"); 92 jQuery(‘#phone‘).focus(); 93 return false; 94 } 95 if (phone.length > 0) { 96 var ab = /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/; 97 if (ab.test(phone) == false) { 98 alert("您的手机号码不正确!"); 99 jQuery(‘#phone‘).focus(); 100 return false; 101 } 102 } 103 104 jQuery.ajax({ 105 type: "post", 106 url: "/KZH/Getcode", 107 data: "phone=" + phone + "&t=" + new Date().toString(), 108 success: function (rval) { 109 if (rval == "0") { 110 alert("您的资料已经提交过,客服人员会尽快与您联系!"); 111 } else if (rval == "1") { 112 alert("信息已发送,请查收!"); 113 var count = 60; 114 var countdown = setInterval(CountDown, 1000); 115 var timeShow = $(".hQBtn") 116 function CountDown() { 117 timeShow.removeAttr("disabled"); 118 //timeShow.val(count + " 秒后重新发送"); 119 timeShow.addClass("btn_hui").val(count + " 秒后重新获取").attr("disabled","true"); 120 if (count == 0) { 121 timeShow.removeClass("btn_hui").val("获取验证码").removeAttr("disabled"); 122 clearInterval(countdown); 123 } 124 count--; 125 } 126 } 127 }, 128 error: function (result) { 129 alert("访问出错!"); 130 } 131 }); 132 }
时间: 2024-11-01 11:54:12