.net和javascript 结合 ,生成三级联动无刷新下拉菜单【修改版】
这个是修改版本:
首先修改了area.js
ClassChange.js
classFunction.js
default2.aspx
主要修改了default2.aspx和 classFunction.js
多的 就不说了 大家可以 比较下
由于地方没有添加完全 所以 只能 看到 江苏 -> 南通 下面的联动
首先修改了area.js
//国家列表
var nation= new Array();
nation[0] = new Array('0','1','阿尔巴尼亚');
nation[1] = new Array('0','2','阿尔及利亚');
nation[2] = new Array('0','3','阿富汗');
nation[3] = new Array('0','4','阿根廷');
nation[4] = new Array('0','5','阿拉伯联合酋长国');
nation[5] = new Array('0','6','阿鲁巴');
nation[6] = new Array('0','7','阿曼');
nation[7] = new Array('0','8','阿塞拜疆');
nation[8] = new Array('0','9','埃及');
nation[9] = new Array('0','10','埃塞俄比亚');
nation[10] = new Array('0','11','爱尔兰');
nation[11] = new Array('0','12','爱沙尼亚');
nation[12] = new Array('0','13','安道尔');
nation[13] = new Array('0','14','安哥拉');
nation[14] = new Array('0','15','安圭拉岛');
nation[15] = new Array('0','16','安提瓜和巴布达');
nation[16] = new Array('0','17','奥地利');
nation[17] = new Array('0','18','澳大利亚');
nation[18] = new Array('0','19','澳门特别行政区');
nation[19] = new Array('0','20','巴巴多斯');
nation[20] = new Array('0','21','巴布亚新几内亚');
nation[21] = new Array('0','22','巴哈马');
nation[22] = new Array('0','23','巴基斯坦');
nation[23] = new Array('0','24','巴拉圭');
nation[24] = new Array('0','25','巴林');
nation[25] = new Array('0','26','巴拿马');
nation[26] = new Array('0','27','巴西');
nation[27] = new Array('0','28','白俄罗斯');
nation[28] = new Array('0','29','百慕大群岛');
nation[29] = new Array('0','30','保加利亚');
nation[30] = new Array('0','31','北马里亚纳群岛');
nation[31] = new Array('0','32','贝宁');
nation[32] = new Array('0','33','比利时');
nation[33] = new Array('0','34','冰岛');
nation[34] = new Array('0','35','波多黎各');
nation[35] = new Array('0','36','波兰');
nation[36] = new Array('0','37','波斯尼亚和黑塞哥维那');
nation[37] = new Array('0','38','玻利维亚');
nation[38] = new Array('0','39','伯利兹');
nation[39] = new Array('0','40','博茨瓦纳');
nation[40] = new Array('0','41','不丹');
//省份列表
var province = new Array();
province[0] = new Array('236','238','安徽');
province[1] = new Array('236','2948','澳门');
province[2] = new Array('236','239','北京');
province[3] = new Array('236','241','福建');
province[4] = new Array('236','242','甘肃');
province[5] = new Array('236','243','广东');
province[6] = new Array('236','244','广西');
province[7] = new Array('236','245','贵州');
province[8] = new Array('236','246','海南');
province[9] = new Array('236','247','河北');
province[10] = new Array('236','248','河南');
province[11] = new Array('236','249','黑龙江');
province[12] = new Array('236','250','湖北');
province[13] = new Array('236','251','湖南');
province[14] = new Array('236','252','吉林');
province[15] = new Array('236','253','江苏');
province[16] = new Array('236','254','江西');
province[17] = new Array('236','255','辽宁');
province[18] = new Array('236','256','内蒙古');
province[19] = new Array('236','257','宁夏');
province[20] = new Array('236','258','青海');
province[21] = new Array('236','259','山东');
province[22] = new Array('236','260','山西');
province[23] = new Array('236','261','陕西');
province[24] = new Array('236','262','上海');
province[25] = new Array('236','263','四川');
province[26] = new Array('236','2949','台湾');
province[27] = new Array('236','264','天津');
province[28] = new Array('236','265','西藏');
province[29] = new Array('236','2947','香港');
province[30] = new Array('236','266','新疆');
province[31] = new Array('236','267','云南');
province[32] = new Array('236','268','浙江');
province[33] = new Array('236','240','重庆');
//市级列表
var city= new Array();
city[0] = new Array('251','1645','永州','425000','0746');
city[1] = new Array('263','2468','广元','628000','0839');
city[2] = new Array('240','2946','万州区','401420','023');
city[3] = new Array('2947','2950','湾仔区','','00852');
city[4] = new Array('2947','2951','东区','','00852');
city[5] = new Array('2947','2952','中西区','','00852');
city[6] = new Array('2947','2953','南 区','','00852');
city[7] = new Array('2947','2954','北 区','','00852');
city[8] = new Array('2947','2955','九龙城区','','00852');
city[9] = new Array('2949','2956','台北市','222','2');
city[10] = new Array('2949','2957','高雄市','800','7');
city[11] = new Array('2949','2958','台中市','400','42');
city[12] = new Array('2949','2959','台南市','700','62');
city[13] = new Array('2949','2960','基隆市','200','32');
city[14] = new Array('2949','2961','新竹市','300','35');
city[15] = new Array('2949','2962','嘉义市','600','52');
city[16] = new Array('2949','2963','台北县','222','2');
city[17] = new Array('2949','2964','宜兰县','','');
city[18] = new Array('2949','2965','桃园县','','');
city[19] = new Array('2949','2966','新竹县','300','35');
city[20] = new Array('2949','2967','苗栗县','','');
city[21] = new Array('2949','2968','台中县','400','42');
city[22] = new Array('2949','2975','高雄县','800','7');
city[23] = new Array('2949','2970','彰化县','','');
city[24] = new Array('2949','2971','南投县','','');
city[25] = new Array('2949','2972','云林县','','');
city[26] = new Array('2949','2973','嘉义县','600','52');
city[27] = new Array('2949','2974','台南县','700','62');
city[28] = new Array('2949','2976','屏东县','','');
city[29] = new Array('2949','2977','台东县','','');
city[30] = new Array('2949','2978','花莲县','','');
city[31] = new Array('2949','2979','澎湖县','','');
city[32] = new Array('2947','2982','观塘区','','00852');
city[33] = new Array('2947','2983','油尖旺区','','00852');
city[34] = new Array('2947','2984','深水埗区','','00852');
city[35] = new Array('2947','2985','葵青区','','00852');
city[36] = new Array('2947','2986','沙田区','','00852');
city[37] = new Array('2947','2987','黄大仙区','','00852');
city[38] = new Array('2947','2988','荃湾区','','00852');
city[39] = new Array('2947','2989','元朗区','','00852');
city[40] = new Array('2947','2990','屯门区','','00852');
city[41] = new Array('2947','2991','离岛区','','00852');
city[42] = new Array('2947','2992','西贡区','','00852');
city[43] = new Array('2947','2993','大埔区','','00852');
city[44] = new Array('2948','2994','澳门半岛','','00853');
city[45] = new Array('2948','2995','凼仔','','00853');
city[46] = new Array('2948','2996','路环','','00853');
city[47] = new Array('238','272','安庆','246000','0556');
city[48] = new Array('238','273','蚌埠','233000','0552');
city[49] = new Array('238','274','巢湖','238000','0565');
city[50] = new Array('238','275','池州','','');
city[51] = new Array('238','276','滁州','239000','0550');
city[52] = new Array('238','277','阜阳','236000','0558');
city[53] = new Array('238','278','合肥','230000','0551');
city[54] = new Array('238','279','淮北','235000','0561');
city[55] = new Array('238','280','淮南','232000','0554');
city[56] = new Array('238','281','黄山','245000','0559');
city[57] = new Array('238','282','六安','237000','0564');
city[58] = new Array('238','283','马鞍山','243000','0555');
city[59] = new Array('238','284','宿州','234000','0557');
city[60] = new Array('238','285','铜陵','244000','0562');
city[61] = new Array('238','286','芜湖','241000','0553');
city[62] = new Array('238','287','宣城','242000','0563');
city[63] = new Array('238','288','亳州','236802','');
city[64] = new Array('239','289','东城区','100007','010');
city[65] = new Array('241','290','福州','350000','0591');
city[66] = new Array('241','291','龙岩','364000','0597');
city[67] = new Array('241','292','南平','353000','0599');
city[68] = new Array('241','293','宁德','352100','0593');
city[69] = new Array('241','294','莆田','351100','0594');
city[70] = new Array('241','295','泉州','362000','0595');
city[71] = new Array('241','296','三明','365000','0598');
city[72] = new Array('241','297','厦门','361000','0592');
city[73] = new Array('241','298','漳州','363000','0596');
city[74] = new Array('242','299','白银','730900','0943');
city[75] = new Array('242','300','定西','743000','0932');
city[76] = new Array('242','301','甘南藏族自治州','747000','09411');
city[77] = new Array('242','302','嘉峪关','735100','0937');
city[78] = new Array('242','303','金昌','733000','0935');
city[79] = new Array('242','304','酒泉','735000','0937');
city[80] = new Array('242','305','兰州','730000','0931');
city[81] = new Array('242','306','临夏回族自治州','731800','09401');
city[82] = new Array('242','307','陇南','','');
city[83] = new Array('242','308','平凉','744000','0943');
city[84] = new Array('242','309','庆阳','745100','09441');
city[85] = new Array('242','310','天水','741000','0938');
city[86] = new Array('242','311','武威','733000','');
city[87] = new Array('242','312','张掖','734000','0936');
city[88] = new Array('243','313','潮州','515600','0768');
city[89] = new Array('243','314','东莞','511700','0769');
city[90] = new Array('243','315','佛山','528000','0757');
city[91] = new Array('243','316','广州','510000','020');
city[92] = new Array('243','317','河源','517000','0762');
city[93] = new Array('243','318','惠州','516000','0752');
city[94] = new Array('243','319','江门','529000','0750');
city[95] = new Array('243','320','揭阳','515500','0663');
city[96] = new Array('243','321','茂名','525000','0668');
city[97] = new Array('243','322','梅州','514000','0753');
city[98] = new Array('243','323','清远','511500','0763');
city[99] = new Array('243','324','汕头','515000','0754');
city[100] = new Array('243','325','汕尾','516600','0660');
city[101] = new Array('253','25353','南京','2262626','025');
city[102] = new Array('253','25354','苏州','215100','0512');
city[103] = new Array('253','25355','无锡','215000','0510');
city[104] = new Array('253','25356','南通','226262','0513');
city[105] = new Array('253','25357','扬州','222222','025');
city[106] = new Array('253','25358','泰州','2262626','025');
city[107] = new Array('253','25359','淮阴','2262626','025');
city[108] = new Array('253','25360','连云港','2262626','025');
var region= new Array();
region[0] = new Array('1645','164545','汕尾1','516600','0660');
region[1] = new Array('2468','246868','汕尾2','516600','0660');
region[2] = new Array('2946','294646','汕尾3','516600','0660');
region[3] = new Array('316','31616','汕尾4','516600','0660');
region[4] = new Array('325','32525','汕尾5','516600','0660');
region[5] = new Array('25356','295852','南通','516600','0660');
region[6] = new Array('25356','295853','启东','516600','0660');
region[7] = new Array('25356','295854','海门','516600','0660');
region[8] = new Array('25356','295855','海安','516600','0660');
region[9] = new Array('25356','295856','通州','516600','0660');
region[10] = new Array('25356','295857','如皋','516600','0660');
var PostCode,TelCode;
PostCode='';
TelCode='';
function CreateNationID(targForm){//生成国家级分类
var targ=targForm.NationID;
targ.length = 0;
targ.options[targ.length] = new Option('选择国家','0');
for(i=0; i<nation.length; i++){
targ.options[targ.length] = new Option(nation[i][2], nation[i][1]);
}
targ.selectedIndex=236 //选定中国
}
function CreateProvinceID(targForm){//生成省级分类 targForm为目标表单
var parent=targForm.NationID;
var subfield=targForm.ProvinceID;
var classid;
if(parent.length>0)
classid=parent.options[parent.selectedIndex].value
else
classid=parent.value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择省份','0');
for (i=0; i < province.length; i++){
if (province[i][0] == classid){
subfield.options[subfield.length] = new Option(province[i][2], province[i][1]);
}
}
}
function CreateCityID(targForm){//生成市级分类
var subfield=targForm.CityID;
var classid=targForm.ProvinceID.options[targForm.ProvinceID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择城市','0');
for (i=0; i < city.length; i++){
if (city[i][0] == classid){
subfield.options[subfield.length] = new Option(city[i][2], city[i][1]);
}
}
}
function CreateCountyID(targForm){//生成区县级分类
var subfield=targForm.CountyID;
var classid=targForm.CityID.options[targForm.CityID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择区县','0');
for (i=0; i < county.length; i++){
if (county[i][0] == classid){
subfield.options[subfield.length] = new Option(county[i][2], county[i][1]);
}
}
}
function CreatePostTelCode(targForm) {//生成邮编、区号
var classid=targForm.CityID.options[targForm.CityID.selectedIndex].value;
for (i=0; i < city.length; i++){
if (city[i][1] == classid){
PostCode=city[i][3];
TelCode=city[i][4];
break;
}
}
}
添加了一个叫region的数组var nation= new Array();
nation[0] = new Array('0','1','阿尔巴尼亚');
nation[1] = new Array('0','2','阿尔及利亚');
nation[2] = new Array('0','3','阿富汗');
nation[3] = new Array('0','4','阿根廷');
nation[4] = new Array('0','5','阿拉伯联合酋长国');
nation[5] = new Array('0','6','阿鲁巴');
nation[6] = new Array('0','7','阿曼');
nation[7] = new Array('0','8','阿塞拜疆');
nation[8] = new Array('0','9','埃及');
nation[9] = new Array('0','10','埃塞俄比亚');
nation[10] = new Array('0','11','爱尔兰');
nation[11] = new Array('0','12','爱沙尼亚');
nation[12] = new Array('0','13','安道尔');
nation[13] = new Array('0','14','安哥拉');
nation[14] = new Array('0','15','安圭拉岛');
nation[15] = new Array('0','16','安提瓜和巴布达');
nation[16] = new Array('0','17','奥地利');
nation[17] = new Array('0','18','澳大利亚');
nation[18] = new Array('0','19','澳门特别行政区');
nation[19] = new Array('0','20','巴巴多斯');
nation[20] = new Array('0','21','巴布亚新几内亚');
nation[21] = new Array('0','22','巴哈马');
nation[22] = new Array('0','23','巴基斯坦');
nation[23] = new Array('0','24','巴拉圭');
nation[24] = new Array('0','25','巴林');
nation[25] = new Array('0','26','巴拿马');
nation[26] = new Array('0','27','巴西');
nation[27] = new Array('0','28','白俄罗斯');
nation[28] = new Array('0','29','百慕大群岛');
nation[29] = new Array('0','30','保加利亚');
nation[30] = new Array('0','31','北马里亚纳群岛');
nation[31] = new Array('0','32','贝宁');
nation[32] = new Array('0','33','比利时');
nation[33] = new Array('0','34','冰岛');
nation[34] = new Array('0','35','波多黎各');
nation[35] = new Array('0','36','波兰');
nation[36] = new Array('0','37','波斯尼亚和黑塞哥维那');
nation[37] = new Array('0','38','玻利维亚');
nation[38] = new Array('0','39','伯利兹');
nation[39] = new Array('0','40','博茨瓦纳');
nation[40] = new Array('0','41','不丹');
//省份列表
var province = new Array();
province[0] = new Array('236','238','安徽');
province[1] = new Array('236','2948','澳门');
province[2] = new Array('236','239','北京');
province[3] = new Array('236','241','福建');
province[4] = new Array('236','242','甘肃');
province[5] = new Array('236','243','广东');
province[6] = new Array('236','244','广西');
province[7] = new Array('236','245','贵州');
province[8] = new Array('236','246','海南');
province[9] = new Array('236','247','河北');
province[10] = new Array('236','248','河南');
province[11] = new Array('236','249','黑龙江');
province[12] = new Array('236','250','湖北');
province[13] = new Array('236','251','湖南');
province[14] = new Array('236','252','吉林');
province[15] = new Array('236','253','江苏');
province[16] = new Array('236','254','江西');
province[17] = new Array('236','255','辽宁');
province[18] = new Array('236','256','内蒙古');
province[19] = new Array('236','257','宁夏');
province[20] = new Array('236','258','青海');
province[21] = new Array('236','259','山东');
province[22] = new Array('236','260','山西');
province[23] = new Array('236','261','陕西');
province[24] = new Array('236','262','上海');
province[25] = new Array('236','263','四川');
province[26] = new Array('236','2949','台湾');
province[27] = new Array('236','264','天津');
province[28] = new Array('236','265','西藏');
province[29] = new Array('236','2947','香港');
province[30] = new Array('236','266','新疆');
province[31] = new Array('236','267','云南');
province[32] = new Array('236','268','浙江');
province[33] = new Array('236','240','重庆');
//市级列表
var city= new Array();
city[0] = new Array('251','1645','永州','425000','0746');
city[1] = new Array('263','2468','广元','628000','0839');
city[2] = new Array('240','2946','万州区','401420','023');
city[3] = new Array('2947','2950','湾仔区','','00852');
city[4] = new Array('2947','2951','东区','','00852');
city[5] = new Array('2947','2952','中西区','','00852');
city[6] = new Array('2947','2953','南 区','','00852');
city[7] = new Array('2947','2954','北 区','','00852');
city[8] = new Array('2947','2955','九龙城区','','00852');
city[9] = new Array('2949','2956','台北市','222','2');
city[10] = new Array('2949','2957','高雄市','800','7');
city[11] = new Array('2949','2958','台中市','400','42');
city[12] = new Array('2949','2959','台南市','700','62');
city[13] = new Array('2949','2960','基隆市','200','32');
city[14] = new Array('2949','2961','新竹市','300','35');
city[15] = new Array('2949','2962','嘉义市','600','52');
city[16] = new Array('2949','2963','台北县','222','2');
city[17] = new Array('2949','2964','宜兰县','','');
city[18] = new Array('2949','2965','桃园县','','');
city[19] = new Array('2949','2966','新竹县','300','35');
city[20] = new Array('2949','2967','苗栗县','','');
city[21] = new Array('2949','2968','台中县','400','42');
city[22] = new Array('2949','2975','高雄县','800','7');
city[23] = new Array('2949','2970','彰化县','','');
city[24] = new Array('2949','2971','南投县','','');
city[25] = new Array('2949','2972','云林县','','');
city[26] = new Array('2949','2973','嘉义县','600','52');
city[27] = new Array('2949','2974','台南县','700','62');
city[28] = new Array('2949','2976','屏东县','','');
city[29] = new Array('2949','2977','台东县','','');
city[30] = new Array('2949','2978','花莲县','','');
city[31] = new Array('2949','2979','澎湖县','','');
city[32] = new Array('2947','2982','观塘区','','00852');
city[33] = new Array('2947','2983','油尖旺区','','00852');
city[34] = new Array('2947','2984','深水埗区','','00852');
city[35] = new Array('2947','2985','葵青区','','00852');
city[36] = new Array('2947','2986','沙田区','','00852');
city[37] = new Array('2947','2987','黄大仙区','','00852');
city[38] = new Array('2947','2988','荃湾区','','00852');
city[39] = new Array('2947','2989','元朗区','','00852');
city[40] = new Array('2947','2990','屯门区','','00852');
city[41] = new Array('2947','2991','离岛区','','00852');
city[42] = new Array('2947','2992','西贡区','','00852');
city[43] = new Array('2947','2993','大埔区','','00852');
city[44] = new Array('2948','2994','澳门半岛','','00853');
city[45] = new Array('2948','2995','凼仔','','00853');
city[46] = new Array('2948','2996','路环','','00853');
city[47] = new Array('238','272','安庆','246000','0556');
city[48] = new Array('238','273','蚌埠','233000','0552');
city[49] = new Array('238','274','巢湖','238000','0565');
city[50] = new Array('238','275','池州','','');
city[51] = new Array('238','276','滁州','239000','0550');
city[52] = new Array('238','277','阜阳','236000','0558');
city[53] = new Array('238','278','合肥','230000','0551');
city[54] = new Array('238','279','淮北','235000','0561');
city[55] = new Array('238','280','淮南','232000','0554');
city[56] = new Array('238','281','黄山','245000','0559');
city[57] = new Array('238','282','六安','237000','0564');
city[58] = new Array('238','283','马鞍山','243000','0555');
city[59] = new Array('238','284','宿州','234000','0557');
city[60] = new Array('238','285','铜陵','244000','0562');
city[61] = new Array('238','286','芜湖','241000','0553');
city[62] = new Array('238','287','宣城','242000','0563');
city[63] = new Array('238','288','亳州','236802','');
city[64] = new Array('239','289','东城区','100007','010');
city[65] = new Array('241','290','福州','350000','0591');
city[66] = new Array('241','291','龙岩','364000','0597');
city[67] = new Array('241','292','南平','353000','0599');
city[68] = new Array('241','293','宁德','352100','0593');
city[69] = new Array('241','294','莆田','351100','0594');
city[70] = new Array('241','295','泉州','362000','0595');
city[71] = new Array('241','296','三明','365000','0598');
city[72] = new Array('241','297','厦门','361000','0592');
city[73] = new Array('241','298','漳州','363000','0596');
city[74] = new Array('242','299','白银','730900','0943');
city[75] = new Array('242','300','定西','743000','0932');
city[76] = new Array('242','301','甘南藏族自治州','747000','09411');
city[77] = new Array('242','302','嘉峪关','735100','0937');
city[78] = new Array('242','303','金昌','733000','0935');
city[79] = new Array('242','304','酒泉','735000','0937');
city[80] = new Array('242','305','兰州','730000','0931');
city[81] = new Array('242','306','临夏回族自治州','731800','09401');
city[82] = new Array('242','307','陇南','','');
city[83] = new Array('242','308','平凉','744000','0943');
city[84] = new Array('242','309','庆阳','745100','09441');
city[85] = new Array('242','310','天水','741000','0938');
city[86] = new Array('242','311','武威','733000','');
city[87] = new Array('242','312','张掖','734000','0936');
city[88] = new Array('243','313','潮州','515600','0768');
city[89] = new Array('243','314','东莞','511700','0769');
city[90] = new Array('243','315','佛山','528000','0757');
city[91] = new Array('243','316','广州','510000','020');
city[92] = new Array('243','317','河源','517000','0762');
city[93] = new Array('243','318','惠州','516000','0752');
city[94] = new Array('243','319','江门','529000','0750');
city[95] = new Array('243','320','揭阳','515500','0663');
city[96] = new Array('243','321','茂名','525000','0668');
city[97] = new Array('243','322','梅州','514000','0753');
city[98] = new Array('243','323','清远','511500','0763');
city[99] = new Array('243','324','汕头','515000','0754');
city[100] = new Array('243','325','汕尾','516600','0660');
city[101] = new Array('253','25353','南京','2262626','025');
city[102] = new Array('253','25354','苏州','215100','0512');
city[103] = new Array('253','25355','无锡','215000','0510');
city[104] = new Array('253','25356','南通','226262','0513');
city[105] = new Array('253','25357','扬州','222222','025');
city[106] = new Array('253','25358','泰州','2262626','025');
city[107] = new Array('253','25359','淮阴','2262626','025');
city[108] = new Array('253','25360','连云港','2262626','025');
var region= new Array();
region[0] = new Array('1645','164545','汕尾1','516600','0660');
region[1] = new Array('2468','246868','汕尾2','516600','0660');
region[2] = new Array('2946','294646','汕尾3','516600','0660');
region[3] = new Array('316','31616','汕尾4','516600','0660');
region[4] = new Array('325','32525','汕尾5','516600','0660');
region[5] = new Array('25356','295852','南通','516600','0660');
region[6] = new Array('25356','295853','启东','516600','0660');
region[7] = new Array('25356','295854','海门','516600','0660');
region[8] = new Array('25356','295855','海安','516600','0660');
region[9] = new Array('25356','295856','通州','516600','0660');
region[10] = new Array('25356','295857','如皋','516600','0660');
var PostCode,TelCode;
PostCode='';
TelCode='';
function CreateNationID(targForm){//生成国家级分类
var targ=targForm.NationID;
targ.length = 0;
targ.options[targ.length] = new Option('选择国家','0');
for(i=0; i<nation.length; i++){
targ.options[targ.length] = new Option(nation[i][2], nation[i][1]);
}
targ.selectedIndex=236 //选定中国
}
function CreateProvinceID(targForm){//生成省级分类 targForm为目标表单
var parent=targForm.NationID;
var subfield=targForm.ProvinceID;
var classid;
if(parent.length>0)
classid=parent.options[parent.selectedIndex].value
else
classid=parent.value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择省份','0');
for (i=0; i < province.length; i++){
if (province[i][0] == classid){
subfield.options[subfield.length] = new Option(province[i][2], province[i][1]);
}
}
}
function CreateCityID(targForm){//生成市级分类
var subfield=targForm.CityID;
var classid=targForm.ProvinceID.options[targForm.ProvinceID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择城市','0');
for (i=0; i < city.length; i++){
if (city[i][0] == classid){
subfield.options[subfield.length] = new Option(city[i][2], city[i][1]);
}
}
}
function CreateCountyID(targForm){//生成区县级分类
var subfield=targForm.CountyID;
var classid=targForm.CityID.options[targForm.CityID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择区县','0');
for (i=0; i < county.length; i++){
if (county[i][0] == classid){
subfield.options[subfield.length] = new Option(county[i][2], county[i][1]);
}
}
}
function CreatePostTelCode(targForm) {//生成邮编、区号
var classid=targForm.CityID.options[targForm.CityID.selectedIndex].value;
for (i=0; i < city.length; i++){
if (city[i][1] == classid){
PostCode=city[i][3];
TelCode=city[i][4];
break;
}
}
}
ClassChange.js
function CreateRootID(targForm){//生成省级分类 targForm为目标表单
var parent=targForm.NationID;
var subfield=targForm.RootID;
var classid;
if(parent.length>0)
classid=parent.options[parent.selectedIndex].value
else
classid=parent.value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择省份','0');
for (i=0; i < province.length; i++){
if (Root[i][0] == classid){
subfield.options[subfield.length] = new Option(Root[i][2], Root[i][1]);
}
}
}
function CreateClassID(targForm){//生成市级分类
var subfield=targForm.ClassID;
var classid=targForm.RootID.options[targForm.RootID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择城市','0');
for (i=0; i < Class.length; i++){
if (Class[i][0] == classid){
subfield.options[subfield.length] = new Option(Class[i][2], Class[i][1]);
}
}
}
function CreateKindID(targForm){//生成区县级分类
var subfield=targForm.KindID;
var classid=targForm.ClassID.options[targForm.ClassID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择区县','0');
for (i=0; i < Kind.length; i++){
if (Kind[i][0] == classid){
subfield.options[subfield.length] = new Option(Kind[i][2], Kind[i][1]);
}
}
}
var parent=targForm.NationID;
var subfield=targForm.RootID;
var classid;
if(parent.length>0)
classid=parent.options[parent.selectedIndex].value
else
classid=parent.value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择省份','0');
for (i=0; i < province.length; i++){
if (Root[i][0] == classid){
subfield.options[subfield.length] = new Option(Root[i][2], Root[i][1]);
}
}
}
function CreateClassID(targForm){//生成市级分类
var subfield=targForm.ClassID;
var classid=targForm.RootID.options[targForm.RootID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择城市','0');
for (i=0; i < Class.length; i++){
if (Class[i][0] == classid){
subfield.options[subfield.length] = new Option(Class[i][2], Class[i][1]);
}
}
}
function CreateKindID(targForm){//生成区县级分类
var subfield=targForm.KindID;
var classid=targForm.ClassID.options[targForm.ClassID.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('选择区县','0');
for (i=0; i < Kind.length; i++){
if (Kind[i][0] == classid){
subfield.options[subfield.length] = new Option(Kind[i][2], Kind[i][1]);
}
}
}
classFunction.js
// JScript 文件
function CreateRootID(targForm,sType){//生成一级分类 targForm为目标表单
var targ=targForm.RootID;
targ.length = 0;
targ.options[targ.length] = new Option('一级分类','');
for(i=0; i<province.length; i++){
targ.options[targ.length] = new Option(province[i][2], province[i][1]);
}
}
function CreateClassID(targForm){//生成二级分类 targForm为目标表单
var parent=targForm.RootID;
var subfield=targForm.ClassID;
var classid;
classid=parent.options[parent.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('二级分类','');
for (i=0; i < city.length; i++){
if (city[i][0] == classid){
subfield.options[subfield.length] = new Option(city[i][2], city[i][1]);
}
}
}
function CreateKindID(targForm){//生成三级分类 targForm为目标表单
var parent=targForm.ClassID;
var subfield=targForm.KindID;
var classid;
classid=parent.options[parent.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('三级分类','');
for (i=0; i < region.length; i++){
if (region[i][0] == classid){
subfield.options[subfield.length] = new Option(region[i][2], region[i][1]);
}
}
}
function CreateRootID(targForm,sType){//生成一级分类 targForm为目标表单
var targ=targForm.RootID;
targ.length = 0;
targ.options[targ.length] = new Option('一级分类','');
for(i=0; i<province.length; i++){
targ.options[targ.length] = new Option(province[i][2], province[i][1]);
}
}
function CreateClassID(targForm){//生成二级分类 targForm为目标表单
var parent=targForm.RootID;
var subfield=targForm.ClassID;
var classid;
classid=parent.options[parent.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('二级分类','');
for (i=0; i < city.length; i++){
if (city[i][0] == classid){
subfield.options[subfield.length] = new Option(city[i][2], city[i][1]);
}
}
}
function CreateKindID(targForm){//生成三级分类 targForm为目标表单
var parent=targForm.ClassID;
var subfield=targForm.KindID;
var classid;
classid=parent.options[parent.selectedIndex].value;
subfield.length = 0;
subfield.options[subfield.length] = new Option('三级分类','');
for (i=0; i < region.length; i++){
if (region[i][0] == classid){
subfield.options[subfield.length] = new Option(region[i][2], region[i][1]);
}
}
}
default2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script src="area.js" type="text/javascript"></script>
<script src="ClassChange.js" type="text/javascript"></script>
<script src="classFunction.js" type="text/javascript"></script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="composeform" method="post" runat="server">
<table class="table" id="Table2" cellSpacing="1" cellPadding="5" width="100%" border="0">
<TBODY>
<tr class="xingmu">
<td align="center" colSpan="4">搜索、添加</td>
</tr>
<tr class="back">
<td style="WIDTH: 92px" align="right">分类:</td>
<td style="WIDTH: 279px">
<select name="RootID" id="RootID" onchange="CreateClassID(this.form);this.form.KindID.length=1;">
<option value="" selected>一级分类</option>
</select>
<select name="ClassID" id="ClassID" onchange="CreateKindID(this.form);">
<option value="" selected>二级分类</option>
</select>
<select name="KindID" id="KindID">
<option value="" selected>三级分类</option>
</select>
</td>
</tr>
</TBODY>
</table>
</form>
<script type="text/javascript">
<!--
tf=document.composeform;
CreateRootID(tf,1);
CreateClassID(tf);
CreateKindID(tf);
//-->
</script>
</body>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script src="area.js" type="text/javascript"></script>
<script src="ClassChange.js" type="text/javascript"></script>
<script src="classFunction.js" type="text/javascript"></script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="composeform" method="post" runat="server">
<table class="table" id="Table2" cellSpacing="1" cellPadding="5" width="100%" border="0">
<TBODY>
<tr class="xingmu">
<td align="center" colSpan="4">搜索、添加</td>
</tr>
<tr class="back">
<td style="WIDTH: 92px" align="right">分类:</td>
<td style="WIDTH: 279px">
<select name="RootID" id="RootID" onchange="CreateClassID(this.form);this.form.KindID.length=1;">
<option value="" selected>一级分类</option>
</select>
<select name="ClassID" id="ClassID" onchange="CreateKindID(this.form);">
<option value="" selected>二级分类</option>
</select>
<select name="KindID" id="KindID">
<option value="" selected>三级分类</option>
</select>
</td>
</tr>
</TBODY>
</table>
</form>
<script type="text/javascript">
<!--
tf=document.composeform;
CreateRootID(tf,1);
CreateClassID(tf);
CreateKindID(tf);
//-->
</script>
</body>
</HTML>
主要修改了default2.aspx和 classFunction.js
多的 就不说了 大家可以 比较下
由于地方没有添加完全 所以 只能 看到 江苏 -> 南通 下面的联动