JS Verify mobile phone number

Source: Internet
Author: User

This article is also a collection of a large number of JS verification of mobile phone number code, all from the network, if you are not very understanding, you can directly take us now mobile phone number verification code to use OH.

JS Verify mobile phone number

Mobile phone number verification, verify 13 series and 150-159 (excluding 154), 180, 185, 186, 187, 188, 189 several numbers, length 11 bits
function Ismobel (value)
{
if (/^13d{9}$/g.test (value) | | (/^15[0-35-9]d{8}$/g.test (value)) | |
(/^18[05-9]d{8}$/g.test (value)) {
return true;
}else{
return false;
}
}

String.prototype.isMobile = function () {
Return (/^ (?: 13d|15[89])-?d{5} (The d{3}|*{3})/.test (this. Trim ());

function IsMobile (MOBILE)
{
if (mobile.length!=11)
{
Alert (' Please enter a valid phone number 111cn.net! ');
Document.form1.mobile.focus ();
return false;
}

var Myreg =/^ ((13[0-9]{1}) |159) +d{8}) $/;

var myreg =/^ ((13[0-9]{1}) |159| ( 15[0-9]{1})) +d{8}) $/;
if (!myreg.test (mobile))
{
Alert (' Please enter a valid phone number www.111cn.net! ');
Document.form1.mobile.focus ();
return false;
}
return true;
}

function Yz (v) {
var a =/^ ((d{3}) | ( d{3}-))? 13d{9}|15[89]d{8}$/;
if (v.length!=11| |! V.match (a)) {
Alert ("Please enter the correct mobile phone number");
}

function Chmobilephone (SRC)
{

if (/^13d{9}$/(src) | | (/^15[8,9]d{8}$/(SRC)) {
return true;
}else{
return false;
}
}    


Unction Checkmobile (Mobileno) {

if (mobileno.trim () = = "") {

return true;

}

var regu =/^[1] ([3][0-9]{1}|59|58) [0-9]{8}$/;

var re = new RegExp (Regu);

if (Re.test (Mobileno)) {

return true;

}else{

Alert ("Phone format is not correct!");

return false;

}

}

The above mobile phone number is the verification of the expression test, each has its own characteristics, fees and I do not say much more let's take a look at these regular phone number validation function bar.

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.