MVC 正则表达式判断手机号码

//正则表达式判断手机号码格式 

        function checkMobile(mobile) {

            var _d = /^1[3578][01379]\d{8}$/g//电信号码 

            var _l = /^1[34578][01256]\d{8}$/g; //联通号码 

            var _y = /^(134[012345678]\d{7}|1[34578][012356789]\d{8})$/g//移动号码 

 

            if (_d.test(mobile) || _l.test(mobile) || _y.test(mobile)) {

                $("#MobileTelephone").removeClass("has-error");

                ContactWay = true;

            }

            else {

                $("#MobileTelephone").addClass("has-error");

                ContactWay = false;

            }

        }

猜你喜欢

转载自blog.csdn.net/weixin_44540455/article/details/87894636
今日推荐