User name/password/email check and submit

Source: Internet
Author: User
Detecting user Names
function Accountcheck () {
var account = Document.validateForm.account.value;
var D1 = document.getElementById ("D1");
if (account = = "") {
d1.innerhtml = "* Please enter account name";
return false;
}else{
d1.innerhtml = "";
}

}


Verifying passwords
function Pass1check () {
var pass1 = document.getElementById ("Pass1"). Value;
var D2 = document.getElementById ("D2");
var reg3 =/^[0-9a-za-z]{6,}$/;
if (Pass1 = = "") {
d2.innerhtml = "* Please enter password";
return false;
} else if (!reg3.test (Pass1)) {
d2.innerhtml = "* Password should consist of more than six letters or numbers";
return false;
}else{
d2.innerhtml = "";
}

}


Verifying passwords
function Pass2check () {
var pass1 = document.getElementById ("Pass1"). Value;
var pass2 = document.getElementById ("Pass2"). Value;
var d3 = document.getElementById ("D3");
if (Pass2 = = "") {
d3.innerhtml = "* Please enter the confirmation password";
return false;
}else if (pass1! = pass2) {
d3.innerhtml = "* Password inconsistent";
return false;
} else{
d3.innerhtml = "";
}

}


//Verify the mailbox format
function Emailcheck () {
var mail = document.getElementById ("email"). Value;
var d4 = document.getElementById ("D4");
var reg6 =/^[\da-za-z]{1,}@[\da-za-z]{1,}\.com$/;
if (!reg6.test (mail) &&mail!= "") {
d4.innerhtml = "* Mailbox format error";
return false;
}else{
d4.innerhtml = "";
}
}

//Submit
$ (document). Ready (function () {
$ ("#register"). Click (function () {
var check1 = ac Countcheck ();
var check2 = Pass1check ();
var check3 = Pass2check ();
var check4 = Emailcheck ();
if (! ( Check1 = = False | | Check2 = = False | | Check3 = = False | | Check4 = = False) {
$ ("#registerForm"). Submit ();
}

})
})

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.