Js user name and password login registration verification code [verifiable password strength]

Source: Internet
Author: User
Tags trim
Tip: you can modify some code before running

<!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><script language="javascript"><!--function changepas(thevalue,typec){if(typec==1){if (thevalue.length>=6&&thevalue.length<10){regpas.innerHTML=' <font color=green>密码强度: 中 </font>';j++;}else{if (thevalue.length>=10){regpas.innerHTML=' <font color=green>密码强度:高<font>';j++;}elseregpas.innerHTML=' <font color=red>密码长度不够</font>';}}if (typec==0&&thevalue==document.forms[0].signup_password.value){regpas1.innerHTML=' <font color=green>正确:密码匹配</font>';j++;}else if(typec==0&&thevalue!=document.forms[0].signup_password.value){regpas1.innerHTML=' <font color=red>两次输入密码不一致</font>';}}function checkreg(types){if (!document.forms[0].checkbox.checked){alert('你必须同意用户协议才可以注册');return false;}for(i=0;i<3;i++){if(!document.forms[0].elements[i].value.match(/S/)){document.forms[0].elements[i].style.backgroundColor='#FFFF99';document.forms[0].elements[i].select();alert('此项不能为空');return false;}}if(!checkregExpFunc(document.forms[0].elements[0].value)){document.forms[0].elements[0].style.backgroundColor='#FFFF99';document.forms[0].elements[0].select();alert('用户名必须是4-20个英文字母、数字或下划线');return false;}if(document.forms[0].elements[1].value!=document.forms[0].elements[2].value){document.forms[0].elements[2].style.backgroundColor='#FFFF99';document.forms[0].elements[2].select();alert('两次输入密码不相同');return false;}document.forms[0].action='i_include/register2.asp?thistype='+types;document.forms[0].method='post';return true;}function c_state(tags){for(i=1;i<=4;i++){if (tags==i)document.getElementById("rege_zhusi"+i).style.color='#FF0000';elsedocument.getElementById("rege_zhusi"+i).style.color='#999999';}}function checkregExpFunc(args){var pattern =/^w+$/;if (!pattern.test(args))return falseelsereturn true;}function checklogin(i){var keyvalueif(i==1){keyvalue=document.getElementById("signup_user").valuekeyvalue=trim(keyvalue)if(keyvalue==""){document.getElementById("rege_zhusi1").innerHTML="<strong>用户名不能为空</strong>"}else if(!checkregExpFunc(keyvalue)||keyvalue.length<4||keyvalue.length>20){document.getElementById("rege_zhusi1").innerHTML="<strong>4-20个英文字母、数字或下划线</strong>"}else{var aa=1checkuser(aa,keyvalue)//document.getElementById("rege_zhusi1").innerHTML=""}}if(i==2){keyvalue=document.getElementById("signup_password").valuekeyvalue=trim(keyvalue)if(keyvalue==""){document.getElementById("rege_zhusi2").innerHTML="<strong>密码不能为空</strong>"}else if(!checkregExpFunc(keyvalue)||keyvalue.length<6||keyvalue.length>20){document.getElementById("rege_zhusi2").innerHTML="<strong>密码为6-20的英文字母、数字或下划线</strong>"}else{document.getElementById("rege_zhusi2").innerHTML=""}}if(i==3){keyvalue=document.getElementById("signup_password1").valuekeyvalue=trim(keyvalue)if(keyvalue==""){document.getElementById("rege_zhusi3").innerHTML="<strong>确认密码不能为空</strong>"}else if(keyvalue!=document.getElementById("signup_password").value){document.getElementById("rege_zhusi3").innerHTML="<strong>两次输入的密码不一致</strong>"}else{document.getElementById("rege_zhusi3").innerHTML=""}}if(i==4){keyvalue=document.getElementById("signup_email").valuekeyvalue=trim(keyvalue)if(keyvalue==""){document.getElementById("rege_zhusi4").innerHTML="<strong>邮箱不能为空</strong>"}else if(!test(keyvalue)){document.getElementById("rege_zhusi4").innerHTML="<strong>邮箱格式不正确</strong>"}else{document.getElementById("rege_zhusi4").innerHTML=""}}c_state(i)}--></script></head><body><div class="user_page"> <div class="user_center"> <div class="user_left"> <div class="user_leftpic"></div> </div><div id="register" ></div><form action="" name="signup_form" id="signup_form" onsubmit="return checkreg(1)"><div class="rege_right" id="form_input"> <div class="user_text"> <div class="rege_text1">Registration process: personal user agreement, fill in personal account-> fill in resume-> submit resume to the enterprise</div> <div class="rege_text2"> <p>User name:<input name="signup_user" type="text" class="rege_tttt" onblur="checklogin(1)" />* 4-20 English letters, numbers, or underscores</p> <p></p> </div> <div id="retal" ></div> <div class="rege_text3">User password:<input name="signup_password" type="password" class="rege_tttt" onblur="checklogin(2)" />* The password is 6-20 English letters, numbers, or underscores</div><div id="regpas" ></div> <div class="rege_text3">Confirm password:<input name="signup_password1" type="password" class="rege_tttt" onblur="checklogin(3)" />* Confirm the duplicate password.</div><div id="regpas1" ></div> <div class="rege_text3">Email:<input name="signup_email" type="text" class="rege_tttt" onblur="checklogin(4)" />* Enter your most commonly used E-MAIL</div> <div id="email" ></div> </div> <div class="user_text5"> <div><strong> <input type="checkbox" name="checkbox" value="checkbox" checked />I have carefully read and agree to abide by the individual user service agreement</strong></div><div><input src="images/uers_login/rege_tt.gif" width="143" height="33" border="0" /></div> </div></div></form> </div>This article is provided by China's first WEB site<div class="user_foot"> </div></div> </body></html>
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.