Regular Expression ^ 1 [3 | 4 | 5 | 8] [0-9] \ D {4, 8} $
^ 1 indicates a Chinese mobile phone number starting with 1.
[3 | 4 | 5 | 8] After 1, it can be a number of 3, 4, 5, or 8. If the phone number starting with 190 is displayed, the following is required: [3 | 4 | 5 | 8 | 9]
[0-9] indicates any number in the middle of 0-9, which can be 0 or 9.
The \ D {} is the same as that of [0-9]. It is a number in the middle of 0-9. {4, 8} indicates matching the first four digits with a maximum of eight digits. Why is it not the 8-bit mobile phone number, because the first seven digits can be used to know the specific address when the phone number is retrieved from the location, and the last four digits will not be affected.
<SCRIPT type = "text/JavaScript">
Function checkmobile (){
VaR smobile = Document. mobileform. Mobile. Value
If (! (/^ 1 [3 | 5 | 8] [0-9] \ D {4, 8} $/. Test (smobile ))){
Alert ("the first seven digits of a complete 11-digit mobile phone number or a correct mobile phone number ");
Document. mobileform. Mobile. Focus ();
Return false;
}
}
</SCRIPT>
<Form action = "http://ip.jb51.net/sj/mobile2.asp" name = "mobileform" method = "Post" onsubmit = "Return checkmobile ();">
<Input name = "mobile" class = TDC size = "40" maxlength = "11">
<Input name = "action" type = "hidden" value = Mobile> <input class = bdtj name = b1 type = submit value = "">
</Form>