<HTML>
<Head>
<Title> JS Regular Expression </title>
</Head>
<Body>
<Script language = "JavaScript">
// Match a landline or PHS, for example, in the format of 031185907468 or 02185907468
Function isphone1 (){
VaR num = Document. getelementbyid ('Ph '). value;
VaR partten =/^ 0 ([1-9]/d) | ([3-9]/d {2})/d {8} $ /;
If (partten. Test (Num )){
Alert ('yesphone number ');
} Else {
Alert ('not a phone number ');
}
}
Function isphone2 (){
VaR num = Document. getelementbyid ('mb'). value;
VaR partten =/^ 1 [3, 5]/d {9} $ /;
If (partten. Test (Num )){
Alert ('mobile phone number ');
} Else {
Alert ('not a mobile phone number ');
}
}
</SCRIPT>
Enter a landline or PHS Number: <input type = "text" name = "phone" id = "PH"> <input type = "button" value = "test" onclick = "isphone1 ();">
Enter the mobile phone number: <input type = "text" name = "phone" id = "MB"> <input type = "button" value = "test" onclick = "isphone2 ();">
</Body>
</Html>