JS mobile phone number, zip code, area code, ID card Verification program

Source: Internet
Author: User

JS mobile phone number, zip code, area code, ID card Verification program

Mobile phone Number Inquiry
function Checkmobile () {
var smobile = Document.mobileform.mobile.value
if (!) ( /^13[0-9]d{4,8}$/.test (Smobile))) {
Alert ("Please enter your mobile number (at least the first 7 digits)");
Document.mobileform.mobile.focus ();
return false;
}
}
Postcode inquiry
function Checkpost () {
var spost = Document.postform.post.value
if (!) ( /^d{6}$/.test (Spost))) {
Alert ("Please enter 6-digit ZIP code");
Document.postform.post.focus ();
return false;
}
}
Area code Query
function Checkarea () {
var sareanum = Document.areaform.areaNum.value
if (!) ( /^d{3,5}$/.test (Sareanum))) {
Alert ("Please enter the correct area code, 3-5 digits");
Document.areaform.areaNum.focus ();
return false;
}
}
ID Card Inquiry
function Checkidcard () {
var SID = document. IDcardform.IDcard.value
if (!) ( /^d{15}$|^d{18}$|^d{17}x$/.test (SID))) {
Alert ("Please enter 15-or 18-digit ID number");
Document. IDcardform.IDcard.focus ();
return false;
}
}
function CheckIDcard15 (theform) {
var SID = IDcardform.IDcard.value
if (!) ( /^d{15}$/.test (SID))) {
Alert ("Please enter 15-digit ID number");
IDcardform.IDcard.focus ();
return false;
}
}

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.