标签:
<select name="pro" onchange="t()">
<option value="">请选择</option>
<option value="0">北京</option>
<option value="1">安徽</option>
</select>
<select name="city"></select>
<script>
var area=[[‘朝阳‘,‘房山‘,‘昌平‘],[‘合肥‘,‘芜湖‘,‘铜陵‘]]
function t(){
var pro=document.getElementsByName(‘pro‘)[0]
var len=area[pro.value].length
str=‘‘
for(var i=0;i<len;i+=1){
str=str+‘<option value="‘ + i + ‘" > ‘+ area[pro.value][i]+‘</option>‘
}
document.getElementsByName(‘city‘)[0].innerHTML=str
}
</script>
标签:
原文地址:http://www.cnblogs.com/gelei/p/4981166.html