<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<!--
http://www.zou114.com/shouji/
手机号码归属地定位查询,本站手机号码查询数据库数据直接来源于移动联通。支持中国移动、中国电信、中国联通目前已经启用的所有手机号段,归属地能较准确、全面地定位到各地级市.
运营商号段分配:
中国移动 1340-1348 135 136 137 138 139 150 151 152 157 158 159 187 188
中国联通 130 131 132 155 156 185 186
中国电信 133 1349 153 180 189
-->
<body onLoad="add()">
<table BORDER id="table1"><tr id="row1"><td>中国移动</td><td id="ttd1"></td></tr></table>
<table BORDER id="table2"><tr id="row2"><td>中国联通</td><td id="ttd2"></td></tr></table>
<table BORDER id="table3"><tr id="row3"><td>中国电信</td><td id="ttd3"></td></tr></table>
<script>
function add(){
ttd1.innerHTML = "<input type='test' value=''>";
ttd2.innerHTML = "<input type='test' value=''>";
ttd3.innerHTML = "<input type='test' value=''>";
}
</script>
<input type="text" name="pn" id="pn">
<input type="button" id="fz" value="分组" onClick="fenzu(pn.value,ttd1.firstChild.value,ttd2.firstChild.value,ttd3.firstChild.value)">
<script>
function fenzu(str,ttd1.firstChild.value,ttd2.firstChild.value,ttd3.firstChild.value){ //,ttd1.firstChild.value,ttd2.firstChild.value,ttd3.firstChild.value
alert(str);
var i = 0;
var regEx1 = /^9$/;
var regEx2 = /1(5(0|1|2|7|8|9)|8(7|8)|3(5|6|7|8|9))/;
var regEx3 = /^1(3(0|1|2)|5(5|6)|8(5|6))$/;
var regEx4 = /^133|153|180|189|134$/;
var regEx5 = /^/d{11}$/;
var regEx6 = /^134$/;
var yd = new Array();
var lt = new Array();
var dx = new Array();
var index;
//str = str.replace(" ","");
if(!regEx5.test(str)){
alert("请检查电话号码是否为11位数字");
}
three = str.substr(0,3);
four = str.substr(4,1)
if(regEx2.test(three)){
index = yd.push(str);
ttd1.value = ttd1.firstChild.value + yd[index];;
}else if(regEx3.test(three)){
index = lt..push(str);
ttd2.value = ttd2.firstChild.value + lt[index];
}else if(regEx4.test(three)){
index = dx..push(str);
ttd3.value = ttd3.firstChild.value + dx[index];
}else if(regEx6.test(three)){
if(!regEx1.test(four)){
index = yd.push(str);
ttd1.value = ttd1.firstChild.value + yd[index];
}else{
index = dx.push(str);
ttd3.value = ttd3.firstChild.value + dx[index];
}
}else{
alert("此号码段不存在!");
}
}
</script>
</body>
</html>
这个在浏览器窗口运行后 报错