Requirements: One, mobile phone number is 11 or 12 digits, if 12 digits, then the first digit is 0
The first and second digits of the 11-digit mobile phone number are "13"
The second and third digits of the 12-digit mobile phone number are "13"
Purpose: Check whether the input mobile phone number is correct
Input:
S: string
Return:
Returns False if the validation returns true
*/
Java code
1. function F_check_mobile (obj) {
2. var regu =/(^[1][3][0-9]{9}$) | (^0[1][3][0-9]{9}$)/;
3. var re = new RegExp (Regu);
4. if (Re.test (Obj.value)) {
5. return true;
6.}
7. F_alert (obj, "Please enter the correct mobile phone number");
8. return false;
9.}
10.
function F_check_mobile (obj) {
var regu =/(^[1][3][0-9]{9}$) | (^0[1][3][0-9]{9}$)/;
var re = new RegExp (Regu);
if (Re.test (Obj.value)) {
return true;
}
F_alert (obj, "Please enter the correct mobile phone number");
return false;
}
/*
Requirements: First, the number of telephone numbers, "(", ")" and "-" constitute
Two, the telephone number is 3 to 8 digits
If the phone number contains an area code, then the area code is three digits or four digits
Four, the area code with "(", ")" or "-" and other parts separated
Purpose: Check the format of the phone number you entered correctly
Input:
Strphone: String
Return:
Returns False if the validation returns true
*/
Java code
1. function F_check_phone (obj)
2. {
3. var regu =/(^ ([0][1-9]{2,3}[-]) d{3,8} (-d{1,6})? $) | ( ^ ([0][1-9]{2,3}) d{3,8} ((d{1,6})? $) | (^d{3,8}$)/;
4. var re = new RegExp (regu);
5. if (re.test (obj.value)) {
6. return true;
7. }
8. f_ Alert (obj, "Please enter the correct phone number");
9. return false;
10.}
11.
Function F_check_phone (obj)
{
var regu =/(^ ([0][1-9]{2,3}[-]) d{3,8} (-d{1,6})? $) | ( ^ ([0][1-9]{2,3}) d{3,8} ((d{1,6})? $) | (^d{3,8}$)/;
var re = new RegExp (Regu);
if (re.test (Obj.value)) {
return true;
& nbsp
F_alert (obj, "Please enter the correct phone number");
return false;
}