`
yuky1327
  • 浏览: 123259 次
  • 性别: Icon_minigender_2
  • 来自: 广州
社区版块
存档分类
最新评论

某天要实现判断一串手机号码是否联通号码

 
阅读更多
<html>
<body>

<script type="text/javascript">
document.write("判断是否联通号码!!!!")
var mobileNo = '13017130490;16017130490;16117130490';

function testUnicom(){
var strs= new Array();
strs=mobileNo.split(";");
var unicom = /^(130|131|132|145|155|156|185|186)/

for (i=0;i<strs.length ;i++ ) 
{ 
document.write(strs[i]+"<br/>"); //分割后的字符输出
if(!unicom.test(strs[i])){ 
alert('发现非联通号码');
return ;
} 
}
}

testUnicom(mobileNo);
</script>

</body>
</html>


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics