<!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> Example </title>
<body>
Verify mobile phone Number one
String.prototype.ismobile = function () {
Return (/^ (?: 13d|15[89])-?d{5} (D{3}|*{3}) $/.test (This.trim ());
}
Return (/^ (?: 13d|15[89])-?d{5} (D{3}|*{3}) $/.test (This.trim ());
var mobile =/^ ((d{3}) | ( d{3}-))? 13d{9}|15[0-9]d{8}$/
Regular expression section:
D Represents a number
{7,8} represents 7-8 digits (indicates phone number)
{3,} represents an extension number
d{2,3} represents the area code
+]d{2,3} represents the international area code
^13d{5,9}$///130–139. At least 5 digits, up to 9 digits
/^153d{4,8}$///Unicom 153. At least 4 digits, up to 8 digits
/^159d{4,8}$///Mobile 159. At least 4 digits, up to 8 digits
Verify Two
function Checkmobile (MOBILE)
{
if (Mobile!= "") {&NBSP;&NB sp;
var reg0 =/^13d{5,9}$/;
var reg1 =/^153d{4,8}$/;
var REG2 =/^159d{4,8}$/;
var reg3 =/^0d{10,11}$/;
var reg4 =/^150d{4,8}$/;
var reg5 =/^158d{4,8}$/;
var reg6 =/^15d{5,9}$/;
var my = false;
if (reg0.test (mobile) my=true;
if (reg1.test (mobile)) MY=TRUE;&N bsp;
if (reg2.test (mobile)) my=true;
if (reg3.test (mobile)) My=true;
if (reg4.test (mobile) my=true;
if (reg5.test (mobile)) my=true;
if (reg6.test (mob ile) my=true;
if (!my) {
//alert (' Sorry, you have entered a phone or PHS number with errors. ');
return false;
}
return true;
}
}
Verify Three
var cellphone=/^ (((1[0-9]{1}[0-9]{1})) +d{8}) $/;
if (!cellphone.test (Form1.messagehandset.value))
{
Alert (' Please enter a valid cell phone number! ');
Form1.messagehandset.focus ();
return false;
}
</body>