代码:
<body>
<table>
<thead>
<th>地址:</th>
<th>
<select id='province' onchange="addCity()">
<option>请选择省份</option>
<option>山东省</option>
<option>贵州省</option>
</select>
</th>
<th>
<select id='city'>
<option>请选择城市</option>
</select>
</th>
</thead>
</table>
<script>
var cityList=new Array();
cityList['山东省']=['济南','青岛','临沂'];
cityList['贵州省']=['贵阳','遵义','六盘水'];
function addCity(){
var province=document.getElementById('province').value;
var city=document.getElementById('city');
清空当前下拉列表框的信息
city.options.length=1;
for(var i in cityList){
if(i==province){
for(j in cityList[i]){
city.add(new Option(cityList[i][j],cityList[i][j]),null);
}
}
}
}
</script>
</body>