Home > Web Front-end > JS Tutorial > body text

js supports verification of mobile phone numbers starting with 158 and 159_form effects

WBOY
Release: 2016-05-16 19:13:09
Original
1508 people have browsed it

Added verification for mobile phone numbers starting with 158 and 159.

Copy code The code is as follows:

//Remove the leading and trailing spaces of the string
String. prototype.Trim = function() {
var m = this.match(/^s*(S (s S )*)s*$/);
return (m == null) ? "" : m[1];
}
//Verify legal mobile phone number
String.prototype.isMobile = function() {
return (/^(?:13d|15[89])-? d{5}(d{3}|*{3})$/.test(this.Trim()));
}


should instance:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template