JS Common phone number verification (linkage, mobile, telecommunications)
Unicom number
function C_liantong (v) {
Return/^0? (?: 13[0-3]|15[1-35-6]|186) D{8}$/.test (v);
}
Mobile number
function C_yidong (v) {
Return/^0? (?: 13[4-9]|15[07-9]|18[789]) d{8}$/.test (v);
}
Phone number of Telecom
function C_dianxin (v) {
Return/^0? (?: 189) D{8}$/.test (v);
}
Note: Because the area code and phone number of the site are two areas, this function only verifies the phone number part
The area code is not. Because the area code may be less than 4 digits
Verify the landline number, which can be separated by several numbers--such as 028-12345678-123
function C_tel (v) {
var reg =/^ (?:d {4,8}-) *d{4,8}$/;
if (!) ( Reg.test (v)) return false;
var temp = v.split ('-');
if (temp.length>1) v = temp[1];
Reg =/^ (d) 1+$/;
var reg1 =/^1234 (?: 5|56|567|5678|56789)? $/;
Return! (Reg.test (v) | | Reg1.test (v));
}
Verify the mobile phone number is a mobile or unicom number
function C_mobile (v) {
return C_liantong (v) | | C_yidong (v) | | C_dianxin (v); Wanhua 20100226 Note this row
return/^d{11,16}$/.test (v);
}