<strong>Source code: </strong> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="90079" class="copybut" id="copybut90079" onclick="doCopy('code90079')"><u>Copy code </u></a></span> The code is as follows: </div> <div class="codebody" id="code90079"> <br><! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <br><html> <br>< ;head> <br><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <br><meta name="Author" content="Liu Jiangbo"> <br><script type="text/javascript"> <br>function login(){ <br>var userName=document.getElementById("userName").value; <br>var pwd=document.getElementById( "pwd").value; <br>var repwd=document.getElementById("repwd").value; <br>var address=document.getElementById("address").value; <br>var matchResult=true; <br>if(userName==""||pwd==""||repwd==""||address==""){ <br>alert("Please confirm whether there are any vacancies!"); <br>matchResult=false; <br>}else if(userName.length<6||userName.length>20){ <br>alert("Username length should be between 6 and 20 characters!"); <br>matchResult=false; <br>}else if(userName==pwd||userName==repwd){ <br>alert("Password or repeated password cannot be the same as the username!"); <br>matchResult=false; <br>}else if(pwd.length<6||pwd.length>20||repwd.length<6||repwd.length>20){ <br>alert("The password or repeated password length should be between 6 and Between 20 characters! "); <br>matchResult=false; <br>}else if(pwd!=repwd){ <br>alert("The password and the repeated password are different, please re-enter!"); <br>matchResult=false; <br>}else if(userName.length<6||userName.length>20){ <br>alert("Username length should be between 6 and 20 characters!"); <br>matchResult=false; <br>} <br><br>if(matchResult==true){ <br>var mailreg = /^w @w (.w ) $/; <br>if(!address.match(mailreg)){ <br>alert("Email format is incorrect"); <br>matchResult=false; <br>} <br>} <br><br><br>if(matchResult==true){ <br>if(userName .charAt(0)>=0&&userName.charAt(0)<=9){ <BR>alert("Username cannot start with numeric characters!"); <BR>matchResult=false; <BR>} <BR>} <br><br>return matchResult; <BR>} <BR></script> <br><title>User registration and verification</title> <br></head> <br> <br><body> <br><center> <br><form name="loginForm" action="http://www.ytu.edu.cn" onsubmit="return login()" method= "post"> <br><table bgcolor="#6666FF" width="300" cellspacing="0" cellpadding="0" border="0" align="left" valign="top"> <br><tr> <br><td class="table-title" colspan="2" align="center" bgcolor="#3366FF">User registration</td> <br></ tr> <br><tr> <br><td width="130" height="28" align="left">Login username</td> <br><td><input id="userName" name="userName" type="text" class="input"></td> <br></tr> <br><tr> <br><td width= "80" height="28" align="left">Login password</td> <br><td><input id="pwd" name="pwd" type="password" class=" input"></td> <br></tr> <br><tr> <br><td width="80" height="28" align="left">Re-enter password </td> <br><td><input id="repwd" name="repwd" type="password" class="input"></td> <br></tr> <br><tr> <br><td width="80" height="28" align="left">Valid email address</td> <br><td><input id= "address" name="address" type="text" class="input"></td> <br></tr> <br><tr> <br><br><!- -<td width="10" height="28" align="left"></td>--> <br><td colspan="2"> <br><input type ="submit" value="Login"> <br><input type="button" value="Cancel" onClick="reset()"></td> <br></tr> <br></table> <br></form> <br></center> <br><br></body> <br></html> <br> </div> <br><strong>Effect implementation:</strong> <br><img src="http://files.jb51.net/file_images/article/201311/201311191619256.gif?20131019161942" alt="JS simple implementation of login verification with renderings_Basic knowledge" >