<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<TITLE>JS standard telephone, fax number </title>
<script language= "Web Effects" >
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 ();
}
}
}
JS Authentication Phone Number
The phone number is not as fixed as before and the number is escalating. So to make the simplest and most practical number verification
1, in the phone number only allow "0-9", "-", "+"
var cellphone=/^ ([d-+]*) $/;
if (!cellphone.test (Form1.messagephone.value))
{
Alert (' You enter a valid phone number! ');
Form1.messagephone.focus ();
return false;
}
For more details please see: http://www.111cn.net/wy/js-ajax/35354.htm
</script>
<body>
</body>