注册时的一些验证:
- <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <htmlxmlns="http://www.w3.org/1999/xhtml">
- <head>
- <Metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"/>
- <title></title>
- <scripttype="text/javascript">
- @H_502_56@//window.onload=toSubmit;
- @H_502_56@//window.onload=validateEmail;
- @H_502_56@//window.onload=validatePhone;
- @H_502_56@//window.onload=validateMobilePhone;
- @H_502_56@//window.onload=validateQQ;
- @H_502_56@//window.onload=validateMSN;
- @H_502_56@//window.onload=validateNet;
- window.onload=validateIP;
- @H_502_56@/**验证是不是字母和数字的组合!==4-14位字母数字的组合=注册时对用户名的验证*/
- functiontoSubmit(){
- varparam=/^[0-9a-zA-Z]*([a-zA-Z]+[0-9]+|[0-9]+[a-zA-Z]+)[0-9a-zA-Z]*$/;
- varusername="HNA123";
- varresult=param.test(username);
- alert(result);
- }
- @H_502_56@/**对Email的验证*/
- functionvalidateEmail(){
- varregEmail=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
- varemail="tt23omom@125.com";
- varresult=regEmail.test(email);
- alert(result);
- }
- @H_502_56@/**验证电话号码==========。*/
- functionvalidatePhone(){
- varregPhone=/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
- varphone="021-60825088";@H_502_56@//"0427-7531992";//"76423865";
- varresult=regPhone.test(phone);
- alert(result);
- }
- @H_502_56@/**验证手机号码-----*/
- functionvalidateMobilePhone(){
- varregMobile=/^1[3|4|5|6|7|8|9][0-9]{1}[0-9]{8}$/;
- varmobile="13877794164";
- varresult=regMobile.test(mobile);
- alert(result);
- }
- @H_502_56@/**验证QQ号*/
- functionvalidateQQ(){
- varregQQ=/^[1-9]\d{4,8}$/;
- varqq="294851313";
- varresult=regQQ.test(qq);
- alert(result);
- }
- @H_502_56@/**验证MSN*/
- functionvalidateMSN(){
- varregEmail=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
- varmsn="12345@liehuo.net";
- varresult=regEmail.test(msn);
- alert(result);
- }
- @H_502_56@/**验证网址============以http://开头*/
- functionvalidateNet(){
- varregNet=/^http:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?$/;
- varurl="http://game.baidu.com";
- varresult=regNet.test(url);
- alert(result);
- }
- @H_502_56@/**验证IP*/
- functionvalidateIP(){
- varcheckIp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
- varip="192.168.25.103";
- varresult=checkIp.test(ip);
- alert(result);
- }
- </script>
- </head>
- <body>
- </body>
- </html>