1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 移动联通电信手机号校验

移动联通电信手机号校验

时间:2018-06-12 21:41:02

相关推荐

移动联通电信手机号校验

移动号段:【目前19种】

134 135 136 137 138 139

150 151 152 157 158 159

147 178182 183 184 187 188

联通号段:【目前11种】

130 131 132171 175 176185 186 155 156145

电信号段:【目前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" οninput="chk_first()" οnblur="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("请输入正确的手机号码");

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。