


js mobile phone number legality verification code collection_javascript skills
First code:
function Checkreg()
{
//Verify phone number mobile phone number, including 153, 159 segments
if (document.form.phone.value=="" && document.form.UserMobile.value=="") {
alert("Please fill in at least one phone number and mobile phone number!");
document.form.phone.focus();
return false;
}
if (document .form.phone.value != ""){
var phone=document.form.phone.value;
var p1 = /^(([0 ]d{2,3}-)?(0d {2,3})-)?(d{7,8})(-(d{3,}))?$/;
var me = false;
if (p1.test(phone) )me=true;
if (!me){
document.form.phone.value='';
alert('Sorry, there is an error in the phone number you entered. Between the area code and the phone number Please use - to split');
document.form.phone.focus();
return false;
}
}
if (document.form.UserMobile.value != "" ){
var mobile=document.form.UserMobile.value;
var reg0 = /^13d{5,9}$/;
var reg1 = /^153d{4,8}$/;
var reg2 = /^159d{4,8}$/;
var reg3 = /^0d{10,11}$/;
var my = false;
if (reg0.test (mobile))my=true;
if (reg1.test(mobile))my=true;
if (reg2.test(mobile))my=true;
if (reg3.test(mobile ))my=true;
if (!my){
document.form.UserMobile.value='';
alert('Sorry, the mobile phone or PHS number you entered is wrong. ');
document.form.UserMobile.focus();
return false;
}
return true;
}
}
Description
The test method checks whether a pattern exists in the string and returns true if it exists, otherwise it returns false.
Regular expression part:
d represents a number
{7,8} represents 7-8 digits (representing a phone number)
{3,} represents an extension number
d{2,3} represents the area code
]d{2,3} represents the international area code
^13d{5,9}$/ //130?139. At least 5 people, at most 9 people
/^153d{4,8}$/ //China Unicom 153. At least 4 digits, at most 8 digits
/^159d{4,8}$/ //Move 159. At least 4 digits, up to 8 digits
Second one:
var Mobile = $("#varMobilePhone").val();
var Phone = $("#varPhoneNo").val();
if (Mobile == ""&&Phone = = "")
{
alert("Mobile and landline, please fill in at least one contact information!");
$("#varMobilePhone").focus();
return;
}
if(Mobile!="")
{
if(!isMobil(Mobile))
{
alert("Please enter the correct mobile phone number!");
$("#varMobilePhone").focus();
return; }
}
//Mobile phone number verification information
function isMobil(s)
{
var patrn = /(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/;
if (!patrn.exec(s ))
{
return false;
} return true; }
Backend verification is as follows:
if (model.Zip != null)
{
if (!Common .PageValidate.IsValidate(model.Zip,"^\d{6}$"))
{ Common.WebMessage.showMsg(HttpContext.Current, "Please enter the correct zip code");
return;
}
}
if (model.PhoneNo != null)
{
if (!Common.PageValidate.IsValidate(model.PhoneNo, "\d{3}-\d{8}| \d{4}-\d{7}"))
{
Common.WebMessage.showMsg(HttpContext.Current, "Please enter the correct phone number!");
return;
}
}
if (model.MobilePhone != null)
{
if (!Common.PageValidate.IsValidate(model.MobilePhone, "^0{0,1}(13[0- 9]|15[3-9]|15[0-2]|18[0-9])[0-9]{8}$"))
{
Common.WebMessage.showMsg(HttpContext .Current, "Please enter the correct 11-digit valid mobile phone number! ");
return;
}
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



I don’t know if you have such an experience. Your mobile phone often receives some inexplicable text messages, or registration information for some websites or other verification information. In fact, our mobile phone number may be bound to many unfamiliar websites, and we ourselves Even if you don’t know, what I will share with you today is to teach you how to unbind all unfamiliar websites with one click. Step 1: Open the number service platform. This technique is very practical. The steps are as follows: Open WeChat, click the plus icon in the search box, select Add Friend, and then enter the code number service platform to search. We can see that there is a number service platform. Of course, it belongs to a public institution and was launched by the National Institute of Information and Communications Technology. It can help everyone unbind mobile phone number information with one click. Step 2: Check whether the phone has been marked for me

Amap is loved by users for its precise positioning and rich functions. However, during use, sometimes we may need to change the bound mobile phone number to ensure the accuracy of personal information and services. So, how to change the mobile phone number of Amap? The editor has compiled some relevant information, come and take a look with me! How to change the mobile phone number on Amap? Answer: [Amap]-[My]-[Settings Icon]-[Account and Security]-[Mobile Number]-[Change]-[Next Step]. Specific steps: 1. First open the Amap software and enter the home page. We need to click [My] in the lower right corner; 2. Then you can see some related functions in My One Second. Here we click on the upper right corner. [Settings icon] in the corner;

How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

With the continuous advancement of mobile communication technology, mobile phone numbers have become an indispensable communication tool in our daily lives. Sometimes, we need to check the usage status of a mobile phone number, such as verifying whether the number is out of service or in arrears. 1. How to check the usage status of mobile phone number? Contacting the operator's customer service is the most direct way to check the usage status of your mobile phone number. Different operators may have different inquiry methods, but this can usually be accomplished by calling the operator's customer service hotline. When talking to customer service staff, you only need to provide the mobile phone number you need to query, and the customer service staff will provide you with detailed usage status information. Therefore, if you want to know the specific situation of a certain mobile phone number, you can get relevant information by calling the operator's customer service hotline. There are

Many friends don’t know how to change the mobile phone number binding in QQ mailbox, so the editor below will share the method of changing the mobile phone number binding in QQ mailbox. Let’s follow the editor to take a look. I believe it will be helpful to everyone. Step 1: First open the QQ mailbox and select the settings above, as shown below. Step 2: Select the account option in the settings, as shown below. Step 3: Choose to log out immediately, as shown below. Step 4: After logging out, choose to register a mobile phone number and email account. Step 5: Choose to register other accounts in the interface that appears, as shown below. Step 6: Use the new mobile phone number according to the prompts and send text messages, as shown below. Step 7: After the sending is completed, the change is successful. The above is the entire content of how to change the mobile phone number binding in QQ mailbox brought to you by the editor. I hope

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3
