zhongdaowendao 2014-04-23
<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>