


JS method sharing for verifying mobile phone number_javascript skills
First one:
function Checkreg()
{
//Verification 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, the phone number you entered is wrong. Please separate the area code and phone number Split with -');
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 people, maximum 8 people
Second:
The code is as follows:
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; }
The background 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 valid digits 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

We usually receive PDF files from the government or other agencies, some with digital signatures. After verifying the signature, we see the SignatureValid message and a green check mark. If the signature is not verified, the validity is unknown. Verifying signatures is important, let’s see how to do it in PDF. How to Verify Signatures in PDF Verifying signatures in PDF format makes it more trustworthy and the document more likely to be accepted. You can verify signatures in PDF documents in the following ways. Open the PDF in Adobe Reader Right-click the signature and select Show Signature Properties Click the Show Signer Certificate button Add the signature to the Trusted Certificates list from the Trust tab Click Verify Signature to complete the verification Let

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;

1. After opening WeChat, click the search icon, enter WeChat team, and click the service below to enter. 2. After entering, click the self-service tool option in the lower left corner. 3. After clicking, in the options above, click the option of unblocking/appealing for auxiliary verification.

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

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

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
