var str={
"广东":["汕头","揭阳","潮州"],
"福建":["福州","龙岩","莆田"]
}
for(var key in str){
var optionz=document.createElement("option");
optionz.text = key;//text显示,显示key的值
optionz.value = key;//给下面取值
province.options.add(optionz);
}
//第一个下拉框的值改变时,第二个下拉框跟着变化;,级联
province.onchange = function(){
city.innerHTML="";
var arr = str[this.value];//通过value取值
for(var i=0;i<arr.length;i++){
var optionz=document.createElement("option");
optionz.text = arr[i];
optionz.value = arr[i];
city.appendChild(optionz);
}
}