JavaScript Local Authentication User registration information

Source: Internet
Author: User

1 <!--use JS to verify the user's registration information locally, common password settings are too short, the user name is too long, and so on.2 for safety and reliability, it is best to perform two validations on the server. My server language is PHP. 3 local authentication can reduce requests to the server (Novice awareness ~). The following is the specific code,4  -5 <!DOCTYPE HTML>6 <HTML>7 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />8     <Head>9         <title>User Register Page</title>Ten     </Head> One     <Body> A         <Script>     -             functionCheckusername () { -                 varobj=Document.reg_form.user_name.value; the                 if(Obj.length> 6) { - Alert ("user name length exceeds limit! "); -                     return false; -                 } +                 varv_pwd=Document.reg_form.pwd.value; -                 if(V_pwd.length> Ten) { + Alert ("password length exceeds limit! "); A                     return false; at                 }Else if(V_pwd.length< 5) { - Alert ("The password is too short! "); -                     return false; -                 } -                 return true; -             } in         </Script> -         <formname= "Reg_form"Action= "server_register_verify.php"Method= "POST"onsubmit= "return Checkusername ()"> to              <P>User name:<inputtype= "text"name= "user_name" /></P> +              <P>Password:<inputtype= "Password"name= "pwd" /></P> -              <P>Confirm Password:<inputtype= "Password"name= "Pwd_again" /></P> the              <P><inputtype= "Submit" /></P> *         </form> $     </Body>Panax Notoginseng </HTML>

JavaScript Local Authentication User registration information

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.