JS Authentication fixed Phone: can only be a number. and have the corresponding format//028-67519441 or 0839-8777222 or 028-6545124
function Check_validate (value) {
var reg =/^ (d{3,4})-(d{7,8})/;
if (Value.constructor = = string) {
var re = Value.match (reg);
return true;
}
return false;
}
Instance Code two
Telephone number, fax
Check ordinary telephone, fax number: You can "+" start, in addition to numbers, can contain "-"
function Istel (object)
{
Country code (2 to 3 bits)-area code (2 to 3 digits)-Phone number (7 to 8 digits)-ext (3 digits)
var s =document.getelementbyid (object.id). value;
var pattern =/^ ([0+]d{2,3}-)? ( 0d{2,3})-(d{7,8}) (-(D{3,})? $/;
var pattern =/(^[0-9]{3,4}-[0-9]{7,8}$) | (^[0-9]{7,8}$) | (^ ([0-9]{3,4}) [0-9]{3,8}$] | (^0{0,1}13[0-9]{9}$)/;
if (s!= "")
{
if (!pattern.exec (s))
{
Alert (' Please enter the correct phone number: Phone number format is country code (2 to 3 bits)-area code (2 to 3 digits)-Phone number (7 to 8 digits)-EXT (3) "");
Object.value= "";
Object.focus ();
}
}
}
Verify code Two
Check ordinary telephone, fax number: You can "+" start, in addition to numbers, can contain "-"
function Istel (object)
{
Country code (2 to 3 bits)-area code (2 to 3 digits)-Phone number (7 to 8 digits)-ext (3 digits)
var s =document.getelementbyid (object.id). value;
var pattern =/^ ([0+]d{2,3}-)? ( 0d{2,3})-(d{7,8}) (-(D{3,})? $/;
var pattern =/(^[0-9]{3,4}-[0-9]{7,8}$) | (^[0-9]{7,8}$) | (^ ([0-9]{3,4}) [0-9]{3,8}$] | (^0{0,1}13[0-9]{9}$)/;
if (s!= "")
{
if (!pattern.exec (s))
{
Alert (' Please enter the correct phone number: Phone number format is country code (2 to 3 bits)-area code (2 to 3 digits)-Phone number (7 to 8 digits)-EXT (3) "");
Object.value= "";
Object.focus ();
}
}
}