|
| -表单验证 - |
|
| 发布人 |
李宁杭 |
|
| 地 址 |
表单验证 |
| 地 区 |
其他地域 |
| 电 话 |
0000000 |
| Q Q |
未填写 |
| 邮 件 |
未填 |
| <script language="javascript"> <!-- function bbs(theForm) { if (theForm.user.value == "") { alert("请输入用户名!"); theForm.user.focus(); return (false); } if (checktext(theForm.user.value)) { alert("请您输入有效用户名!"); theForm.user.select(); theForm.user.focus(); return (false); } if (theForm.passwd.value == "") { alert("请输入密码!"); theForm.passwd.focus(); return (false); } if (checktext(theForm.passwd.value)) { alert("请您输入有效密码!"); theForm.passwd.select(); theForm.passwd.focus(); return (false); } var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var checkStr = theForm.user.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("您输入的用户名不能含有字符 < / > ! =等!"); theForm.user.focus(); return (false); } if (checktext(theForm.user.value)) { alert("您输入的用户名不能含有字符 < / > ! =等!"); theForm.user.select(); theForm.user.focus(); return (false); } var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var checkStr = theForm.passwd.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("您输入的密码不能含有字符 < / > ! =等!"); theForm.passwd.focus(); return (false); } if (checktext(theForm.passwd.value)) { alert("您输入的密码不能含有字符 < / > ! =等!"); theForm.passwd.select(); theForm.passwd.focus(); return (false); } } function bbs1(theForm) {if (theForm.keyword.value == "") { alert("请输入关键字!"); theForm.keyword.focus(); return (false); } if (checktext(theForm.keyword.value)) { alert("请输入关键字!"); theForm.keyword.select(); theForm.keyword.focus(); return (false); } } function bbs3(theForm) { if (theForm.passwd.value == "" || theForm.passwd1.value == "") { alert("请输入密码!"); theForm.passwd.focus(); return (false); } if (theForm.passwd.value.length <4 || theForm.passwd.value.length>7) { alert("请输入密码必须在4-6位!"); theForm.passwd.focus(); return (false); } if(theForm.passwd.value != theForm.passwd1.value) { alert("两次密码输入不一致") theForm.passwd.select(); theForm.passwd.focus(); return (false); } if(theForm.psda.value == "") {alert("输入密码提示问题!") theForm.psda.select(); theForm.psda.focus(); return (false); } if(theForm.psdq.value == "") {alert("输入密码提示答案!") theForm.psdq.select(); theForm.psdq.focus(); return (false); } if (theForm.email.value == "") { alert("请您输入您的\"E-Mail\"联系方式!"); theForm.email.focus(); return (false); } var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@."; var checkStr = theForm.email.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (theForm.email.value.length < 6) { allValid = false; } if (!allValid) { alert("您输入的 \"电子邮件地址\" 无效!"); theForm.email.focus(); return (false); } address=theForm.email.value; if(address.length>0) { i=address.indexOf("@"); if(i==-1) { window.alert("对不起!您输入的电子邮件地址是错误的!") theForm.email.focus(); return false } ii=address.indexOf(".") if(ii==-1) { window.alert("对不起!您输入的电子邮件地址是错误的!") theForm.email.focus(); return false } } if (checktext(theForm.email.value)) { alert("请您输入有效的\"E-Mail\"!"); theForm.email.select(); theForm.email.focus(); return (false); } } function bbs4(theForm) { if (theForm.name.value |
|
|
|
|
|
|