JavaScript:两个select列表联动

JavaScript:两个select列表联动_第1张图片


var arrs = [];
arrs[0] = ["海淀区","昌平区","朝阳区","通州区","大兴区"];
arrs[1] = ["济南","青岛","日照","威海","潍坊","东营"];
	
function selectProv(){
	var provinceIndex = document.getElementById('sel1').value;
	var str = "";
	if(provinceIndex!=""){
		var cities = arrs[provinceIndex];			
		for(var i = 0; i < cities.length; i++)
			str += "";
	}
	document.getElementById("sel2").innerHTML = str;
}

你可能感兴趣的:(JavaScript,javascript,前端)