Copy code code as follows:
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<Title> Regular expression verification </title>
<script type = "text/javascript" src = "../ scripts/jQuery-1.4.1.min.js"> </script>
<script type = "text/javascript">
var value = {
Istel: Function (s) {
var Patrn =/^((/+? 86) | (/(/+86/))?/D {3,4}-/d {7,8} (-/d {3,4})? $/
if (! Patrn.exec (s)) Return false
Return true
},
Ismobile: Function (Value) {
var valueReg =/^((/+? 86) | (/(/+86/))? 1/d {10} $/;
Return valueReg.test (value);
},
CellPhone: Function () {
var cellphonenumber = $ ("#txtCellphone"). Val ();
if (! Validate.ismobile (Cellphonenumber)) {{
Alert ("The mobile phone number format is incorrect");
Return false;
} Else {
Alert ("Your mobile phone number format is correct");
}
},
Telephone: Function () {
var Telephonenumber = $ ("#txttelephone"). Val ();
if (! Validate.istel (Telephonenumber)) {{
Alert ("Incorrect phone number format");
Return false;
} Else {
Alert ("Your phone number format is correct");
}
}
}
</script>
</head>
<body>
<div>
<Label> Please enter the mobile phone number (support +86): < /label> <input type = "text" id = "txtCellphone" /> <input type = "Button" value = "verification" onClick = "value.cellphone ( ); " /> <br />
<Label> Please enter the phone number (support +86): < /label> <input type = "text" id = "txttelephone" /> <input type = "Button" value = "authentication" onClick = "value.telephone ( ); " /> <br />
</div>
</body>
</html>