移动联通电信手机号校验

移动号段:【目前19种】

       134 135 136 137 138 139    

      150 151 152 157 158 159

      147 178  182 183 184 187 188

联通号段:【目前11种】

       130 131 132   171 175 176  185 186 155 156  145

电信号段:【目前8种】

     133 153 149    180 181 189    177 173(待放) 

【js正则表达式】

电话号整体校验:/^1(3[0-9]|4[579]|5[012356789]|7[0-9]|8[0-9]|9[8])[0-9]{8}$/

移动校验:var ChinaMobile = /^1(3[4-9]|5[012789]|8[23478]|4[7]|7[8])\d{8}$/;//移动

联通校验:var ChinaUnicom =/^1(3[0-2]|5[56]|8[56]|4[5]|7[156])\d{8}$/;//联通

电信校验:var dx = /^1(3[3]|4[9]|5[3]|8[019]|7[37])\d{8}$/; /*电信*/


应用举例:

html:   <input type="tel" oninput="chk_first()" onblur="chk_first()" id="inputtel"  maxlength="13" placeholder="请输入充值号码">

    <div class="tiptext"></div> //提示文字

js:

function chk_first() {
var mobile = $("#inputtel")[0].value;
if(mobile != ""){
  var ChinaMobile = /^1(3[4-9]|5[012789]|8[23478]|4[7]|7[8])\d{8}$/;//移动
  var ChinaUnicom =/^1(3[0-2]|5[56]|8[56]|4[5]|7[156])\d{8}$/;//联通
  var dx = /^1(3[3]|4[9]|5[3]|8[019]|7[37])\d{8}$/; /*电信*/
if(ChinaMobile.test(mobile) || ChinaUnicom.test(mobile) || dx.test(mobile)){
  if(ChinaMobile.test(mobile)){
    $(".tiptext").html("<strong>移动用户</strong>");
  }
  if(ChinaUnicom.test(mobile)){
    $(".tiptext").html("<strong>联通用户</strong>");
  }
  if(dx.test(mobile)){
    $(".tiptext").html("<strong>电信用户</strong>");
  }
}else{
  $(".tiptext").text("请输入正确的手机号码");
}
}

posted on 2017-03-06 14:43  柔光  阅读(769)  评论(0编辑  收藏  举报

导航