JavaScript省市連動
3935 ワード
//function change(){
// ,js
//
//var cityList = new Array();
// js ,
//
//cityList[' '] = [' ',' ',' ',' '];
//cityList[' '] = [' ',' ',' ',' '];
//cityList[' '] = [' ',' ',' ',' '];
var city=[
[" "," "," "," "],
[" "," "," "," "],
[" "," "],
];
function getCity(){
//
var sltProvince=document.form1.province;
//
var sltCity=document.form1.city;
//
var provinceCity=city[sltProvince.selectedIndex - 1];
// ,
sltCity.length=1;
//
for(var i=0;i<provinceCity.length;i++){
sltCity[i+1]=new Option(provinceCity[i]);
}
// alert(document.getElementById("province").value);
}
// , 。 selectedIndex var city=[ [" "," "," "," "], [" "," "," "," "], [" "," "," "," "], [" "," "," "," "], [" "," "," "," "] ];
</div>
<div>
function getCity(){ // var sltProvince=document.form1.province; // var sltCity=document.form1.city; // var provinceCity=city[sltProvince.selectedIndex - 1]; // , sltCity.length=1; // for(var i=0;i<provinceCity.length;i++){ sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]); } }
・