JavaScript实现仿网易通行证表单验证(2)

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>新用户注册页面</title> <link type="text/css" href="https://www.jb51.net/css/register.css" /> <script type="text/javascript" src="https://www.jb51.net/js/register.js"></script> </head> <body> <div><img src="https://www.jb51.net/images/register_logo.gif" alt="logo"/></div> <div> <table cellspacing="0" cellpadding="0"> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td> <form action="" method="post" onsubmit="return checkForm()"> <dl> <dt>通行证用户名:</dt> <dd><input type="text" onfocus="userNameFocus()" onblur="userNameBlur()" /> @163.com</dd> <div></div> </dl> <dl> <dt>登录密码:</dt> <dd><input type="password" onfocus="pwdFocus()" onblur="pwdBlur()"/></dd> <div></div> </dl> <dl> <dt>重复登录密码:</dt> <dd><input type="password" onblur="repwdBlur()"/></dd> <div></div> </dl> <dl> <dt>性别:</dt> <dd><input type="radio" value="" checked="checked"/>男 <input type="radio" value="" />女 </dd> </dl> <dl> <dt>真实姓名:</dt> <dd><input type="text" onblur="aa()" /></dd> </dl> <dl> <dt>昵称:</dt> <dd><input type="text" onfocus="nickNameFocus()" onblur="nickNameBlur()"/></dd> <div></div> </dl> <dl> <dt>关联手机号:</dt> <dd><input type="text" onfocus="telFocus()" onblur="telBlur()" /></dd> <div></div> </dl> <dl> <dt>保密邮箱:</dt> <dd><input type="text" onfocus="emailFocus()" onblur="emailBlur()" /></dd> <div></div> </dl> <dl> <dt></dt> <dd><input type="image" src="https://www.jb51.net/images/button.gif"/></dd> </dl> </form> </td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table> </div> </body> <script type="text/javascript"> function aa(){ var reg = /^[\u4e00-\u9fa5]$/; var name = document.getElementById("realName").value; if(reg.test(name)==false){ alert("只能为汉字"); }else{ alert("正确"); } } </script> </html>

以上所述就是本文的全部内容了,希望大家能够喜欢。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgjyss.html