省名与城名下拉选择框联动
省名与城名下拉选择框联动,省名与城名下拉选择框联动
---------------------------------------------------------------
给你一个,以此类推
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("徐汇区","01","001");
subcat[1] = new Array("嘉定区","01","002");
subcat[2] = new Array("黄浦区","01","003");
subcat[3] = new Array("南昌市","02","004");
subcat[4] = new Array("九江市","02","005");
subcat[5] = new Array("上饶市","02","006");
onecount=6;
function changelocation(locationid)
{
document.myform.smalllocation.length = 0;
var locationid=locationid;
var i;
document.myform.smalllocation.options[0] = new Option('====所有地区====','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
//-->
</script>
</head>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
<option value="01" selected>上海</option>
<option value="02">江西</option>
</select>
<select name="smalllocation">
<option selected value="">==所有地区==</option>
</select>
</form>
---------------------------------------------------------------
<script language=JavaScript>
<!--
ct = new Array();
ct[0] = "none";
//直辖市--北京 1,1
ct[1] = "北京";
//直辖市--上海 2,1
ct[2] = "上海";
//直辖市--天津 3,1
ct[3] = "天津";
//直辖市--重庆 4,1
ct[4] = "重庆";
//河北省的主要城市 5,10
ct[5] = "石家庄";
ct[6] = "保定";
ct[7] = "秦皇岛";
ct[8] = "邯郸";
ct[9] = "承德";
ct[10] = "廊坊";
ct[11] = "张家口";
ct[12] = "沧州";
ct[13] = "邢台";
ct[14] = "唐";
//山西省的主要城市 15,10
ct[15] = "太原";
ct[16] = "长治";
ct[17] = "大同";
ct[18] = "临汾";
ct[19] = "山阴";
ct[20] = "忻州";
ct[21] = "阳泉";
ct[22] = "原平";
ct[23] = "泽州";
ct[24] = "太谷";
//内蒙古自治区的主要城市 25,10
ct[25] = "呼和浩特";
ct[26] = "包头";
ct[27] = "乌海";
ct[28] = "临河";
ct[29] = "东胜";
ct[30] = "赤峰";
ct[31] = "通辽";
ct[32] = "锡林浩特";
ct[33] = "乌兰浩特";
ct[34] = "海拉尔";
//辽宁省的主要城市";35,10
ct[35] = "沈阳";
ct[36] = "大连";
ct[37] = "鞍山";
ct[38] = "抚顺";
ct[39] = "本溪";