Some of the following to provide the number of JS verification phone number of the regular expression, is my collection from the Internet, but are fine, professional for mobile phone number and telephone number for verification.
function Checkphone (phone)
{
Verify the phone number of the phone number, including section 153,159
if (phone== "") {
Alert ("Phone number cannot be empty!");
return false;
}
if (Phone!= "") {
var p1 =/^ ([0+]d{2,3}-)? ( 0d{2,3})? (d{7,8}) (-(D{3,}))? $/;
var me = false;
if (p1.test (phone)) me=true;
if (!me) {
Alert (' Sorry, www.45it.com the phone number you entered has an error. Please use-split ' between area code and telephone number;
return false;
}
}
return true;
}
Mobile phone number Verification
String.prototype.isTel = function ()
{
"Compatible format: Country code 111cn.net (2 to 3 bits)-area code (2 to 3 digits)-Phone number (7 to 8 digits)-ext (3 digits)"
Return (/^ ([0+]d{2,3}-)? ( 0d{2,3})? (d{7,8}) (-(D{3,}))? $/.test (this. Trim ());
Return (/^ ([0+]d{2,3}-)? ( 0d{2,3})-(d{7,8}) (-(D{3,})? $/.test (this. Trim ());
}
Verify the phone number
String.prototype.isMobile = function () {
Return (/^ (?: 13d|15[89])-?d{5} (The d{3}|*{3}) $/.test (this. Trim ());
}
Telephone number Verification
function Checknum () {//Telephone authentication
var Inputvalue=document.gsjbxxbean.dh.value;
var reg=/^ ([0-9]|[ -] +$/g;
var isValid
Isvalid=reg.exec (Inputvalue)
if (!isvalid) {
return False
}
return True
}
Check phone number
function Istel (str) {
var reg=/^ ([0-9][-]) +$/g;
if (str.length<7 str.length>18) {
return false;
}
else{
return reg.exec (str);
}
}