<! DOCTYPE html>
<title>validate</title>
<meta charset= "Utf-8" >
<script src= "Http://libs.baidu.com/jquery/2.0.0/jquery.min.js" ></script>
<style type= "Text/css" >
*{margin:0; padding:0; list-style:none; outline:none;}
#form_id {padding:100px;}
. vidata{font-size:13px; color: #f00;}
</style>
<body>
<form id= ' form_id ' >
<ul>
<li> Tel: <input class= "Input-phone" type= "text" ><span class= ' Vidata ' >*</span></li>
</ul>
</form>
<script type= "Text/javascript" >
$ ('. Input-phone '). focus (function () {alert (1)});
var oe={
input:$ ('. Input-phone '),
vidata:$ ('. Vidata ')
};
OE.Input.keyup (function () {
var oval=oe.input.val (). substr (0,1);
if (oval==1)
{
var ex=/^1[3|4|5|8]\d{9}$/;
if (! Ex.test (OE.Input.val ()))
{
OE.Vidata.text (' * The phone number you entered is wrong! ‘)
}else{
OE.Vidata.text (' * ')
};
}else if (oval==0) {
var ex=/^\d{12}$/;
var ex=/^ ([0\+]\d{2,3}-)? ( 0\d{2,3})? (\d{7,8}) (-(\d{3,}))? $/;p x:051-0793-3281156-001
var ex=/^ ((0\d{2,3})-)? (\d{7,8}) $/;//ps:0793-3281156
if (! Ex.test (OE.Input.val ()))
{
OE.Vidata.text (' * The landline phone number you entered is wrong! ‘)
}else{
OE.Vidata.text (' * ')
};
}else{
OE.Vidata.text (' * You entered the wrong number! ‘)
}
});
</script>
</body>
Mobile phone number verification of landline number