var twocount; twocount=0; sc = new Array(); sc[0] = new Array('市中心','市中心'); sc[1] = new Array('天宁区','天宁区'); sc[2] = new Array('钟楼区','钟楼区'); sc[3] = new Array('新北区','新北区'); sc[4] = new Array('武进区','武进区'); sc[5] = new Array('戚墅堰','戚墅堰'); sc[6] = new Array('市郊区','市郊区'); sc[7] = new Array('金坛市','金坛市'); sc[8] = new Array('溧阳市','溧阳市'); twocount=9; //配合上面生成出来得Javascript数组,控制地区和区域得对应关系 function ChangeDistrict(formname,strDistrict){ formname.strDistrictSmall.length = 0; var i; formname.strDistrictSmall.options[0] = new Option('请选择',''); for (i=0;twocount>i; i++) { if (sc[i][1] == strDistrict) { formname.strDistrictSmall.options[formname.strDistrictSmall.length] = new Option(sc[i][0], sc[i][0]); } } } //定位希望区域得默认值 function ChangeDistrictEd(formname,strDistrictSmall){ var i; formname.strDistrictSmall.selectedIndex = 0; for (i=0;formname.strDistrictSmall.length>i; i++) { if(formname.strDistrictSmall.options[i].value == strDistrictSmall ) { formname.strDistrictSmall.selectedIndex = i; } } }