Created
March 5, 2014 02:19
-
-
Save hubsgz/9359998 to your computer and use it in GitHub Desktop.
js 手机号, 电话号码验证
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//判断是否手机号 | |
function isMobile(v) { | |
var reg = /^1[3|4|5|8][0-9]{9}$/; //手机号 | |
return reg.test(v); | |
} | |
//判断是否电话号码 | |
function isTel(v) { | |
var reg=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/; //电话号码 | |
return reg.test(v); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment