js验证手机号是否正确

1、正则验证手机号是否正确:

var regTest =/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
    if(!regTest.test(mobile)) {
        alert('电话格式不对,请检查');
        return;
    }

 

posted @ 2018-07-04 17:32  狼人666  阅读(335)  评论(0编辑  收藏  举报