表单中,第一个列表框有a,b,c三个选项,当用户选中a时,第二个列表框显示a1,a2,a3三个选项,(若用户在第一个列表框中选择b,第二个列表框显示b1,b2,b3,以此类推),当用户在第二个列表框中选择a1,第三个列表框中显示a11,a12,a13。请问如何实现?
---------------------------------------------------------------
给你一个,以此类推
<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] = "本溪";
ct[40] = "丹东";
ct[41] = "锦州";
ct[42] = "营口";
ct[43] = "辽阳";
ct[44] = "铁岭";
//吉林省的主要城市;45,9
ct[45] = "长春";
ct[46] = "白城";
ct[47] = "松原";
ct[48] = "四平";
ct[49] = "吉林";
ct[50] = "辽源";
ct[51] = "白山";
ct[52] = "通化";
ct[53] = "延边";
//黑龙江省的主要城市;54,10
ct[54] = "哈尔滨";
ct[55] = "大庆";
ct[56] = "黑河";
ct[57] = "鸡西";
ct[58] = "佳木斯";
ct[59] = "牡丹江";
ct[60] = "嫩江";
ct[61] = "齐齐哈尔";
ct[62] = "绥化";
ct[63] = "伊春";
//江苏省的主要城市;64,12
ct[64] = "南京";
ct[65] = "苏州";
ct[66] = "无锡";
ct[67] = "常州";
ct[68] = "镇江";
ct[69] = "扬州";
ct[70] = "南通";
ct[71] = "徐州";
ct[72] = "连云港";
ct[73] = "淮阴";
ct[74] = "泰州";
ct[75] = "宿迁";
//浙江省的主要城市;76,10
ct[76] = "杭州";
ct[77] = "金华";
ct[78] = "宁波";
ct[79] = "温州";
ct[80] = "湖州";
ct[81] = "绍兴";
ct[82] = "嘉兴";
ct[83] = "台州";
ct[84] = "舟山";
ct[85] = "丽水";
//安徽省的主要城市;86,10
ct[86] = "合肥";
ct[87] = "芜湖";
ct[88] = "蚌埠";
ct[89] = "阜阳";
ct[90] = "淮南";
ct[91] = "淮北";
ct[92] = "六安";
ct[93] = "马鞍山";
ct[94] = "铜陵";
ct[95] = "安庆";
// 福建省的主要城市;96,9
ct[96] = "福州";
ct[97] = "厦门";
ct[98] = "泉州";
ct[99] = "漳州";
ct[100] = "龙岩";
ct[101] = "南平";
ct[102] = "宁德";
ct[103] = "莆田";
ct[104] = "三明";
//江西省的主要城市;105,10
ct[105] = "南昌";
ct[106] = "九江";
ct[107] = "新余";
ct[108] = "赣州";
ct[109] = "景德镇";
ct[110] = "上饶";
ct[111] = "抚州";
ct[112] = "宜春";
ct[113] = "吉安";
ct[114] = "鹰潭";
//山东省的主要城市;115,10
ct[115] = "济南";
ct[116] = "青岛";
ct[117] = "淄博";
ct[118] = "德州";
ct[119] = "烟台";
ct[120] = "潍坊";
ct[121] = "济宁";
ct[122] = "枣庄";
ct[123] = "日照";
ct[124] = "莱芜";
//河南省的主要城市;125,10
ct[125] = "洛阳";
ct[126] = "焦作";
ct[127] = "开封";
ct[128] = "南阳";
ct[129] = "平顶山";
ct[130] = "三门峡";
ct[131] = "商丘";
ct[132] = "许昌";
ct[133] = "郑州";
ct[134] = "驻马店";
//ct[134] = "鹤壁";
//湖北省的主要城市;135,10
ct[135] = "武汉";
ct[136] = "宜昌";
ct[137] = "十堰";
ct[138] = "咸宁";
ct[139] = "黄石";
ct[140] = "黄冈";
ct[141] = "襄阳";
ct[142] = "宜城";
ct[143] = "襄樊";
ct[144] = "荆州";
//湖南省的主要城市;145,10
ct[145] = "长沙";
ct[146] = "株洲";
ct[147] = "湘潭";
ct[148] = "常德";
ct[149] = "衡阳";
ct[150] = "岳阳";
ct[151] = "怀化";
ct[152] = "永州";
ct[153] = "自治洲";
ct[154] = "张家界";
//广东省的主要城市;155,8