手机端的注册表单验证js代码.zip
js代码 [removed] function checkreg() { var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})) \d{8})$/; if(document.form1.name.value == "") { //alert("请输入您的用户名!"); document.getElementById("tish")[removed] = "<font color='red'>请输入您的用户名!</font>"; form1.name.focus(); return false; } document.getElementById("tish")[removed] = "<font color='green'>正确</font>"; // if (document.form1.User.value.length<4 || document.form1.User.value.length>15) // { // alert("用户名长度限制在4-15位!"); // form1.User.focus(); // return false; // } if(document.form1.password.value == "") { //alert("请输入密码!"); document.getElementById("ts")[removed] = "<font color='red'>请输入密码</font>"; form1.password.focus(); return false; } if(document.form1.password.value.length < 6 || document.form1.password.value.length > 20) { //alert("密码长度限制在6-20位!"); document.getElementById("ts")[removed] = "<font color='red'>密码长度限制在6-20位!</font>"; form1.password.focus(); return false; } document.getElementById("ts")[removed] = "<font color='green'>正确</font>"; if(document.form1.password.value != document.form1.Pwdagain.value) { document.getElementById("tishi")[removed] = "<font color='red'>两次密码不相同</font>"; form1.password.focus(); return false; } document.getElementById("tishi")[removed] = "<font color='green'>正确</font>"; // alert("注册成功!"); // location.href="http://www.lanrenzhijia.com"; if(!myreg.test(document.form1.phone.value)) { document.getElementById("tss")[removed] = "<font color='red'>手机号码错误</font>"; form1.password.focus(); return false; } document.getElementById("tss")[removed] = "<font color='green'>正确</font>"; if(document.form1.code.value == "") { document.getElementById("tsi")[removed] = "<font color='red'>验证码不能为空</font>"; form1.code.focus(); return false; } document.getElementById("tsi")[removed] = "<font color='green'>正确</font>"; location.href="homepage.html"; } function sendMessage(t) { var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})) \d{8})$/; if(!myreg.test(document.form1.phone.value)) { alert('请输入有效的手机号码!'); return false; } // document.form1.dynamic.disabled = true; for(i = 1; i <= t; i ) { window.setTimeout("update_p(" i "," t ")", i * 1000); } } function update_p(num, t) { if(num == t) { document.form1.dynamic.value = " 重新发送 "; document.form1.dynamic.disabled = false; } else { printnr = t - num; document.form1.dynamic.value = " (" printnr ")秒后重发"; } } [removed]
- 1
- 粉丝: 409
- 资源: 1万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助