<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(function() {
var city = new Array(3);
city[0] = new Array("武汉", "黄冈", "襄阳", "雷军");
city[1] = new Array("长沙", "韶山", "岳阳楼", "张家界");
city[2] = new Array("石家庄", "唐山", "保定市", "廊坊市");
city[3] = new Array("商丘", "信阳", "洛阳", "安阳");
$("#province").change(function() {
$("#city").empty();
var a = this.value;
console.log(a);
$.each(city, function(i, e) {
if(a == i) {
$.each(city[i], function(m, n) {
var txt = document.createTextNode(n);
var op = document.createElement("option");
$(op).append(txt);
$(op).appendTo("#city");
});
}
});
});
});
</script>
</head>
<body>
<select id="province">
<option>请选择</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="city">
</select>
</body>
</html>