Mobile phone number verification of landline number

Source: Internet
Author: User

<! 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.