<head>
<title>全国省市县无刷新多级关联菜单</title>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<style>
body,select
{
font-size:9pt
font-family:Verdana
}
a
{
color:red
text-decoration:none
}
a:hover{
text-decoration:underline
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Dsy()
{
this.Items = {}
}
Dsy.prototype.add = function(id,iArray)
{
this.Items[id] = iArray
}
Dsy.prototype.Exists = function(id)
{
if(typeof(this.Items[id]) == "undefined") return false
return true
}function change(v){
var str="0"
for(i=0i<vi++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1))}
var ss=document.getElementById(s[v])
with(ss){
length = 0
options[0]=new Option(opt0[v],opt0[v])
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str]
for(i=0i<ar.lengthi++)options[length]=new Option(ar[i],ar[i])
if(v)options[1].selected = true
}
}
if(++v<s.length){change(v)}
}
}var dsy = new Dsy()dsy.add("0",["安徽","北京","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","天津","西藏","新疆","云南","浙江","重庆"])dsy.add("0_0",["安庆","蚌埠","巢湖","池州","滁州","阜阳","合肥","淮北","淮南","黄山","六安","马鞍山","宿州","铜陵","芜湖","宣城","亳州"])
dsy.add("0_0_0",["安庆市","怀宁县","潜山县","宿松县","太湖县","桐城市","望江县","岳西县","枞阳县"])
dsy.add("0_0_1",["蚌埠市","固镇县","怀远县","五河县"])
dsy.add("0_0_2",["巢湖市","含山县","和县","庐江县","无为县"])
dsy.add("0_0_3",["池州市","东至县","青阳县","石台县"])
dsy.add("0_0_4",["滁州市","定远县","凤阳县","来安县","明光市","全椒县","天长市"])
dsy.add("0_0_5",["阜南县","阜阳市","界首市","临泉县","太和县","颖上县"])
dsy.add("0_0_6",["长丰县","肥东县","肥西县"])
dsy.add("0_0_7",["淮北市","濉溪县"])
dsy.add("0_0_8",["凤台县","淮南市"])
dsy.add("0_0_9",["黄山市","祁门县","休宁县","歙县","黟县"])
dsy.add("0_0_10",["霍邱县","霍山县","金寨县","六安市","寿县","舒城县"])
dsy.add("0_0_11",["当涂县","马鞍山市"])
dsy.add("0_0_12",["灵璧县","宿州市","萧县","泗县","砀山县"])
dsy.add("0_0_13",["铜陵市","铜陵县"])
dsy.add("0_0_14",["繁昌县","南陵县","芜湖市","芜湖县"])
dsy.add("0_0_15",["广德县","绩溪县","郎溪县","宁国市","宣城市","泾县","旌德县"])
dsy.add("0_0_16",["利辛县","蒙城县","涡阳县","亳州市"])dsy.add("0_1",["北京"])
dsy.add("0_1_0",["北京市","密云县","延庆县"])dsy.add("0_2",["福州","龙岩","南平","宁德","莆田","泉州","三明","厦门","漳州"])
dsy.add("0_2_0",["长乐市","福清市","福州市","连江县","罗源县","闽侯县","闽清县","平潭县","永泰县"])
dsy.add("0_2_1",["长汀县","连城县","龙岩市","上杭县","武平县","永定县","漳平市"])
dsy.add("0_2_2",["光泽县","建阳市","建瓯市","南平市","浦城县","邵武市","顺昌县","松溪县","武夷山市","政和县"])
dsy.add("0_2_3",["福安市","福鼎市","古田县","宁德市","屏南县","寿宁县","霞浦县","周宁县","柘荣县"])
dsy.add("0_2_4",["莆田市","仙游县"])
dsy.add("0_2_5",["安溪县","德化县","惠安县","金门县","晋江市","南安市","泉州市","石狮市","永春县"])
dsy.add("0_2_6",["大田县","建宁县","将乐县","明溪县","宁化县","清流县","三明市","沙县","泰宁县","永安市","尤溪县"])
dsy.add("0_2_7",["厦门市"])
dsy.add("0_2_8",["长泰县","东山县","华安县","龙海市","南靖县","平和县","云霄县","漳浦县","漳州市","诏安县"])dsy.add("0_3",["白银","定西","甘南藏族自治州","嘉峪关","金昌","酒泉","兰州","临夏回族自治州","陇南","平凉","庆阳","天水","武威","张掖"])
dsy.add("0_3_0",["白银市","会宁县","景泰县","靖远县"])
dsy.add("0_3_1",["定西县","临洮县","陇西县","通渭县","渭源县","漳县","岷县"])
dsy.add("0_3_2",["迭部县","合作市","临潭县","碌曲县","玛曲县","夏河县","舟曲县","卓尼县"])
dsy.add("0_3_3",["嘉峪关市"])
dsy.add("0_3_4",["金昌市","永昌县"])
dsy.add("0_3_5",["阿克塞哈萨克族自治县","安西县","敦煌市","金塔县","酒泉市","肃北蒙古族自治县","玉门市"])
dsy.add("0_3_6",["皋兰县","兰州市","永登县","榆中县"])
dsy.add("0_3_7",["东乡族自治县","广河县","和政县","积石山保安族东乡族撒拉族自治县","康乐县","临夏市","临夏县","永靖县"])
dsy.add("0_3_8",["成县","徽县","康县","礼县","两当县","文县","武都县","西和县","宕昌县"])
dsy.add("0_3_9",["崇信县","华亭县","静宁县","灵台县","平凉市","庄浪县","泾川县"])
dsy.add("0_3_10",["合水县","华池县","环县","宁县","庆城县","庆阳市","镇原县","正宁县"])
dsy.add("0_3_11",["甘谷县","秦安县","清水县","天水市","武山县","张家川回族自治县"])
dsy.add("0_3_12",["古浪县","民勤县","天祝藏族自治县","武威市"])
dsy.add("0_3_13",["高台县","临泽县","民乐县","山丹县","肃南裕固族自治县","张掖市"])dsy.add("0_4",["潮州","东莞","佛山","广州","河源","惠州","江门","揭阳","茂名","梅州","清远","汕头","汕尾","韶关","深圳","阳江","云浮","湛江","肇庆","中山","珠海"])
dsy.add("0_4_0",["潮安县","潮州市","饶平县"])
dsy.add("0_4_1",["东莞市"])
dsy.add("0_4_2",["佛山市"])
dsy.add("0_4_3",["从化市","广州市","增城市"])
dsy.add("0_4_4",["东源县","和平县","河源市","连平县","龙川县","紫金县"])
dsy.add("0_4_5",["博罗县","惠东县","惠阳市","惠州市","龙门县"])
dsy.add("0_4_6",["恩平市","鹤山市","江门市","开平市","台山市"])
dsy.add("0_4_7",["惠来县","揭东县","揭西县","揭阳市","普宁市"])
dsy.add("0_4_8",["电白县","高州市","化州市","茂名市","信宜市"])
dsy.add("0_4_9",["大埔县","丰顺县","蕉岭县","梅县","梅州市","平远县","五华县","兴宁市"])
dsy.add("0_4_10",["佛冈县","连南瑶族自治县","连山壮族瑶族自治县","连州市","清新县","清远市","阳山县","英德市"])
dsy.add("0_4_11",["潮阳市","澄海市","南澳县","汕头市"])
dsy.add("0_4_12",["海丰县","陆丰市","陆河县","汕尾市"])
dsy.add("0_4_13",["乐昌市","南雄市","曲江县","仁化县","乳源瑶族自治县","韶关市","始兴县","翁源县","新丰县"])
dsy.add("0_4_14",["深圳市"])
dsy.add("0_4_15",["阳春市","阳东县","阳江市","阳西县"])
dsy.add("0_4_16",["罗定市","新兴县","郁南县","云安县","云浮市"])
dsy.add("0_4_17",["雷州市","廉江市","遂溪县","吴川市","徐闻县","湛江市"])
dsy.add("0_4_18",["德庆县","封开县","高要市","广宁县","怀集县","四会市","肇庆市"])
dsy.add("0_4_19",["中山市"])
dsy.add("0_4_20",["珠海市"])dsy.add("0_5",["百色","北海","崇左","防城港","桂林","贵港","河池","贺州","来宾","柳州","南宁","钦州","梧州","玉林"])
dsy.add("0_5_0",["百色市","德保县","靖西县","乐业县","凌云县","隆林各族自治县","那坡县","平果县","田东县","田林县","田阳县","西林县"])
dsy.add("0_5_1",["北海市","合浦县"])
dsy.add("0_5_2",["崇左市","大新县","扶绥县","龙州县","宁明县","凭祥市","天等县"])
dsy.add("0_5_3",["东兴市","防城港市","上思县"])
dsy.add("0_5_4",["恭城瑶族自治县","灌阳县","桂林市","荔浦县","临桂县","灵川县","龙胜各族自治县","平乐县","全州县","兴安县","阳朔县","永福县","资源县"])
dsy.add("0_5_5",["桂平市","贵港市","平南县"])
dsy.add("0_5_6",["巴马瑶族自治县","大化瑶族自治县","东兰县","都安瑶族自治县","凤山县","河池市","环江毛南族自治县","罗城仡佬族自治县","南丹县","天峨县","宜州市"])
dsy.add("0_5_7",["富川瑶族自治县","贺州市","昭平县","钟山县"])
dsy.add("0_5_8",["合山市","金秀瑶族自治县","来宾市","武宣县","象州县","忻城县"])
dsy.add("0_5_9",["柳城县","柳江县","柳州市","鹿寨县","融安县","融水苗族自治县","三江侗族自治县"])
dsy.add("0_5_10",["宾阳县","横县","隆安县","马山县","南宁市","上林县","武鸣县","邕宁县"])
dsy.add("0_5_11",["灵山县","浦北县","钦州市"])
dsy.add("0_5_12",["苍梧县","蒙山县","藤县","梧州市","岑溪市"])
dsy.add("0_5_13",["北流市","博白县","陆川县","容县","兴业县","玉林市"])
dsy.add("0_6",["安顺","毕节","贵阳","六盘水","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","铜仁","遵义"])
dsy.add("0_6_0",["安顺市","关岭布依族苗族自治县","平坝县","普定县","镇宁布依族苗族自治县","紫云苗族布依族自治县"])
dsy.add("0_6_1",["毕节市","大方县","赫章县","金沙县","纳雍县","黔西县","威宁彝族回族苗族自治县","织金县"])
dsy.add("0_6_2",["贵阳市","开阳县","清镇市","息烽县","修文县"])
dsy.add("0_6_3",["六盘水市","六枝特区","盘县","水城县"])
dsy.add("0_6_4",["从江县","丹寨县","黄平县","剑河县","锦屏县","凯里市","雷山县","黎平县","麻江县","三穗县","施秉县","台江县","天柱县","镇远县","岑巩县","榕江县"])
dsy.add("0_6_5",["长顺县","都匀市","独山县","福泉市","贵定县","惠水县","荔波县","龙里县","罗甸县","平塘县","三都水族自治县","瓮安县"])
dsy.add("0_6_6",["安龙县","册亨县","普安县","晴隆县","望谟县","兴仁县","兴义市","贞丰县"])
dsy.add("0_6_7",["德江县","江口县","石阡县","思南县","松桃苗族自治县","铜仁市","万山特区","沿河土家族自治县","印江土家族苗族自治县","玉屏侗族自治县"])
dsy.add("0_6_8",["赤水市","道真仡佬族苗族自治县","凤冈县","仁怀市","绥阳县","桐梓县","务川仡佬族苗族自治县","习水县","余庆县","正安县","遵义市","遵义县","湄潭县"])dsy.add("0_7",["白沙黎族自治县","保亭黎族苗族自治县","昌江黎族自治县","澄迈县","定安县","东方","海口","乐东黎族自治县","临高县","陵水黎族自治县","琼海","琼中黎族苗族自治县","三亚","屯昌县","万宁","文昌","五指山","儋州"])
dsy.add("0_7_0",["白沙黎族自治县"])
dsy.add("0_7_1",["保亭黎族苗族自治县"])
dsy.add("0_7_2",["昌江黎族自治县"])
dsy.add("0_7_3",["澄迈县"])
dsy.add("0_7_4",["定安县"])
dsy.add("0_7_5",["东方市"])
dsy.add("0_7_6",["海口市"])
dsy.add("0_7_7",["乐东黎族自治县"])
dsy.add("0_7_8",["临高县"])
dsy.add("0_7_9",["陵水黎族自治县"])
dsy.add("0_7_10",["琼海市"])
dsy.add("0_7_11",["琼中黎族苗族自治县"])
dsy.add("0_7_12",["三亚市"])
dsy.add("0_7_13",["屯昌县"])
dsy.add("0_7_14",["万宁市"])
dsy.add("0_7_15",["文昌市"])
dsy.add("0_7_16",["五指山市"])
dsy.add("0_7_17",["儋州市"])dsy.add("0_8",["保定","沧州","承德","邯郸","衡水","廊坊","秦皇岛","石家庄","唐山","邢台","张家口"])
dsy.add("0_8_0",["安国市","安新县","保定市","博野县","定兴县","定州市","阜平县","高碑店市","高阳县","满城县","清苑县","曲阳县","容城县","顺平县","唐县","望都县","雄县","徐水县","易县","涞水县","涞源县","涿州市","蠡县"])
dsy.add("0_8_1",["泊头市","沧县","沧州市","东光县","海兴县","河间市","黄骅市","孟村回族自治县","南皮县","青县","任丘市","肃宁县","吴桥县","献县","盐山县"])
dsy.add("0_8_2",["承德市","承德县","丰宁满族自治县","宽城满族自治县","隆化县","滦平县","平泉县","围场满族蒙古族自治县","兴隆县"])
dsy.add("0_8_3",["成安县","磁县","大名县","肥乡县","馆陶县","广平县","邯郸市","邯郸县","鸡泽县","临漳县","邱县","曲周县","涉县","魏县","武安市","永年县"])
dsy.add("0_8_4",["安平县","阜城县","故城县","衡水市","冀州市","景县","饶阳县","深州市","武强县","武邑县","枣强县"])//-->
</SCRIPT>
<SCRIPT LANGUAGE = JavaScript>
<!--var s=["s1","s2","s3"]
var opt0 = ["省份","地级市","市、县级市、县"]
function setup()
{
for(i=0i<s.length-1i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")")
change(0)
}
//-->
</SCRIPT>
</head>
<body bgcolor="#E0E0E0" onload="setup()">
多级关联菜单:
<form name="frm">
<select id="s1"><option>省份</option></select>
<select id="s2"><option>地级市</option></select>
<select id="s3"><option>市、县级市、县</option></select>
</form></body>
</html>
我很久以前收集的可以用,呵呵希望对你有帮助!
JS 省市区三级联动:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>JS 省市区三级联动</title>
</head>
<body>
<select id="selProvince" name="province">
</select>
<select id="selCity" name="city">
</select>
<select id="selDist" name="area">
</select>
<div></div>
<script type="text/javascript">
var temp
var P = new Array()
var C = new Array()
var D = new Array()
P = new Array("北京","上海","天津","重庆","广东","四川","浙江","贵州","辽宁","江苏","福建","河北","河南"," 吉林","黑龙江","山东","安徽","广西","海南","内蒙古","山西","宁夏","甘肃","陕西","青海","湖北","湖南"," 江西","云南","新疆","香港","澳门")
/*北京*/ C[0] = new Array("北京")
/*上海*/ C[1] = new Array("上海")
/*天津*/ C[2] = new Array("天津")
/*重庆*/ C[3] = new Array("重庆")
/*广东*/ C[4] = new Array("广州","深圳","珠海","佛山","惠州","东莞","中山","江门","湛江","汕头")
/*四川*/ C[5] = new Array("成都","自贡市","攀枝花","泸州")
/*浙江*/ C[6] = new Array("杭州","宁波","嘉兴","绍兴","温州","金华","衢州","舟山","台州","丽水","湖州")
/*贵州*/ C[7] = new Array("贵阳")
/*辽宁*/ C[8] = new Array("沈阳","大连")
/*江苏*/ C[9] = new Array("南京","苏州","南通","无锡","盐城","徐州","常州","连云港","常熟","扬州","镇江","泰州","昆山","吴江")
/*福建*/C[10] = new Array("福州","厦门","泉州")
/*河北*/C[11] = new Array("石家庄","唐山","邯郸","保定","廊坊","衡水","秦皇岛")
/*河南*/C[12] = new Array("郑州","洛阳")
/*吉林*/C[13] = new Array("长春","吉林")
/*黑龙江 */C[14] = new Array("哈尔滨")
/*山东*/C[15] = new Array("济南","青岛","威海","烟台","潍坊","日照","临沂","淄博")
/*安徽*/C[16] = new Array("合肥","芜湖","马鞍山")
/*广西*/C[17] = new Array("南宁","桂林","北海","柳州")
/*海南*/C[18] = new Array("海南","三亚")
/*内蒙古 */C[19] = new Array("呼和浩特","包头")
/*山西*/C[20] = new Array("太原")
/*宁夏*/C[21] = new Array("银川")
/*甘肃*/C[22] = new Array("兰州")
/*陕西*/C[23] = new Array("西安")
/*青海*/C[24] = new Array("西宁")
/*湖北*/C[25] = new Array("武汉","宜昌")
/*湖南*/C[26] = new Array("长沙","株洲","湘潭")
/*江西*/C[27] = new Array("南昌","赣州")
/*云南*/C[28] = new Array("昆明")
/*新疆*/C[29] = new Array("乌鲁木齐")
/*香港*/C[30] = new Array("香港")
/*澳门*/C[31] = new Array("澳门")
/*台湾*/C[31] = new Array("台北")
for(temp in C)
{
D[temp] = new Array()
}
/*北京*/D[0][0] = new Array("海淀区,朝阳区,东城区,西城区,崇文区,宣武区,丰台区,石景山,房山区,门头沟,通州区,顺义区,昌平区,密云区,怀柔区,延庆区,平谷区,大兴区,燕郊区")
/*上海*/D[1][0] = new Array("黄浦区、卢湾区、徐汇区、徐家汇、长宁区、静安区、普陀区、闸北区 虹口区、杨浦区、宝山区、闵行区、嘉定区、浦东新区、松江区、金山区、青浦区、南汇区、奉贤区、崇明县")
/*天津*/D[2][0] = new Array("和平,西青,北辰,大港,南开,河东,河西,河北,津南,红桥,塘沽,汉沽,东丽,宝坻,蓟县,武清,宁河,静海,开发区")
/*重庆*/D[3][0] = new Array("南岸,渝北,万盛,大渡口,万州,北碚,沙坪坝,巴南,双桥,涪陵,江北,九龙坡,渝中")
/*广州*/D[4][0] = new Array("荔湾,越秀,东山,天河,海珠,黄埔,芳村,白云,花都,番禺,东莞,广州经济技术开发区,从化,增城,萝岗,清远,南沙,佛山")
/*深圳*/D[4][1] = new Array("福田,罗湖,南山,盐田,宝安,龙岗")
/*珠海*/D[4][2] = new Array("斗门,横琴,金湾,香洲,坦洲")
/*佛山*/D[4][3] = new Array("南海,顺德,三水,高明,禅城")
/*惠州*/D[4][4] = new Array("博罗县,大亚湾区,惠城区,惠东县,惠阳区,龙门县,仲恺区")
/*东莞*/D[4][5] = new Array("茶山,长安,常平,大朗,大岭山,道?,东城,东坑,凤岗,高?,莞城,洪梅,厚街,黄江,虎门,寮步,麻涌,南城,企石,桥头,清溪,沙 田,石碣,石龙,石排,松山湖,塘厦,万江,望牛墩,谢岗,樟木头,中堂")
/*中山*/D[4][6] = new Array("东区,南区,西区,石岐区,南头镇,古镇镇,东凤镇,小榄镇,黄圃镇,三角镇,民众镇,阜沙镇,火炬区,港口镇,东升镇,横栏镇,沙溪镇,大涌镇,板芙镇,五桂山镇,南朗镇,三乡镇,神湾镇,坦洲镇")
/*江门*/D[4][7] = new Array("新会区,蓬江区,江海区,台山市,恩平市,鹤山市,开平市")
/*成都*/D[5][0] = new Array("青羊,锦江,金牛,武侯,成华,龙泉驿,青白江,高新区,金堂县,新都区,温江区,郫县,双流县,新津县,大邑县,都江堰市,崇州市,邛崃市,蒲江县,彭州市,高新西区,高新西区")
/*杭州*/D[6][0] = new Array("上城,下城,西湖,拱墅,江干,滨江,余杭,萧山,富阳,桐庐,临安,淳安,建德")
/*宁波*/D[6][1] = new Array("海曙,江东,江北,鄞州,镇海,北仑,慈溪,余姚,奉化,宁海,象山,高新区,东钱湖旅游度假区")
/*嘉兴*/D[6][2] = new Array("嘉善,平湖,海盐,海宁,桐乡,秀洲,南湖,市区,经济开发区")
/*绍兴*/D[6][3] = new Array("绍兴县,诸暨市,上虞市,新昌县,越城区,嵊州市")
/*贵阳*/D[7][0] = new Array("云岩,南明,金阳新区,小河,花溪,乌当,白云,清镇,开阳,修文,息烽,小河片,金阳")
/*沈阳*/D[8][0] = new Array("和平,沈河,皇姑,大东,铁西,苏家屯,东陵,新城子,于洪,新民,辽中,康平,法库,浑南新区,沈北新区")
/*大连*/D[8][1] = new Array("西岗,中山,沙河口,甘井子,旅顺口,金州,开发区,高新园区,长兴岛,普兰店,瓦房店,庄河")
/*南京*/D[9][0] = new Array("白下,秦淮,玄武,鼓楼,下关,建邺,江宁,六合,浦口,栖霞,雨花,大厂,溧水,高淳")
/*苏州*/D[9][1] = new Array("园区,新区,平江,沧浪,金阊,虎丘,吴中,昆山,常熟,太仓,张家港,相城,吴江")
/*南通*/D[9][2] = new Array("城东区,城南区,城北区,城中区,狼山区,天生港,唐闸区,观音山区,开发区,海安县,如皋市,如东县,通州,海门,启东市,海门市,港闸,崇川")
/*无锡*/D[9][3] = new Array("崇安区,南长区,北塘区,新区,滨湖区,惠山区,马山区,锡山区,江阴市,宜兴市")
/*盐城*/D[9][4] = new Array("盐城,东台,大丰,盐都,建湖,响水,阜宁,射阳,滨海")
/*徐州*/D[9][5] = new Array("丰县,鼓楼,贾汪,金山桥开发区,沛县,邳州市,泉山,睢宁市,新城区,云龙,铜山区")
/*常州*/D[9][6] = new Array("金坛,溧阳,戚区,天宁,武进,新北,钟楼")
/*连云港 */D[9][7] = new Array()
/*常熟*/D[9][8] = new Array()
/*扬州*/D[9][9] = new Array("宝应市,广陵区,高邮市,邗江区,江都市,开发区,维扬区,仪征市")
/*镇江*/D[9][10] = new Array("丹阳市,句容市,扬中市,丹徒区,京口区,润州区,镇江新区")
/*泰州*/D[9][11] = new Array("城中区,城东区,城西区,城南区,城北区,高港区,泰兴市,姜堰市,兴化市,靖江市")
/*昆山*/D[9][12] = new Array("巴城镇,淀山湖镇,花桥镇,锦溪镇,陆家镇,千灯镇,玉山镇,张浦镇,周市镇,周庄镇")
/*福州*/D[10][0] = new Array("台江,鼓楼,仓山,晋安,马尾,闽侯县,长乐市")
/*厦门*/D[10][1] = new Array("开元,湖里,思明,鼓浪屿,集美,杏林,海沧,同安,翔安,漳州,龙岩,泉州")
/*泉州*/D[10][2] = new Array("丰泽区,安溪县,德化县,惠安县,晋江市,鲤城区,洛江区,南安市,泉港区,石狮市,永春县")
/*石家庄 */D[11][0] = new Array("桥东,桥西,新华,裕华,长安,开发区,正定,平山,鹿泉市,栾城,藁城")
/*唐山*/D[11][1] = new Array("曹妃甸工业区,丰南,丰润,高新区,古冶,海港开发区,汉沽管理区,开平,乐亭县,卢台开发区,路北,路南,滦南县,滦县,南堡开发区,迁安市,迁西县,唐海县,玉田县,遵化市")
/*邯郸*/D[11][2] = new Array()
/*保定*/D[11][3] = new Array()
/*廊坊*/D[11][4] = new Array("安次,广阳,三河,霸州,香河,永清,固安,文安,大城,大厂")
/*衡水*/D[11][5] = new Array("桃城区,深州市,冀州市,安平县,故城县,阜城县,景县,枣强县,武强县,饶阳县,开发区,武邑县,郊区")
/*秦皇岛 */D[11][6] = new Array("北戴河,昌黎县,抚宁县,海港,卢龙县,青龙县,山海关")
/*郑州*/D[12][0] = new Array("金水,中原,管城,二七,邙山,惠济,经济技术开发区,郑东新区")
/*洛阳*/D[12][1] = new Array("涧西区,西工区,老城区,?河区,洛龙区,吉利区,偃师市,栾川县,孟津县,咸阳县,伊川县,宜阳县")
/*长春*/D[13][0] = new Array("朝阳,宽城,二道,南关,绿园,双阳,其它,吉林地区,高新,经开,净月,汽开")
/*吉林*/D[13][1] = new Array("昌邑区,船营区,龙潭区,丰满区,永吉县,舒兰市,磐石市,蛟河市,桦甸市,经开区,高新区")
/*哈尔滨 */D[14][0] = new Array("道里,道外,南岗,动力,平房,香坊,太平,开发区,阿城,呼兰,松北")
/*济南*/D[15][0] = new Array("市中,天桥,历下,槐荫,历城,长清,高新,济阳,平阴,商河,章丘")
/*青岛*/D[15][1] = new Array("市南,市北,四方,李沧,崂山,城阳,黄岛,即墨市,胶州市,胶南市,平度市,莱西市,开发区")
/*威海*/D[15][2] = new Array("环翠区,文登市,荣成市,乳山市,高区,经区")
/*烟台*/D[15][3] = new Array("芝罘区,福山区,龙口市,莱阳市,莱州市,蓬莱市,招远市,莱山区,开发区,牟平区,栖霞市,海阳市,长岛县")
/*潍坊*/D[15][4] = new Array("奎文,潍城,寒亭,坊子,寿光市,高新技术开发区,经济开发区")
/*日照*/D[15][5] = new Array("东港")
/*临沂*/D[15][6] = new Array("兰山")
/*合肥*/D[16][0] = new Array("中市,东市,西市,郊区,庐阳区,包河区,瑶海区,蜀山区,高新区,新站区,经开区,政务区,滨湖新区")
/*南宁*/D[17][0] = new Array("兴宁,青秀,西乡塘,江南,良庆,邕宁,桂林市,北海市,钦州市")
/*桂林*/D[17][1] = new Array("秀峰区,叠彩区,象山区,七星区,雁山区,西城区,八里街区")
/*北海*/D[17][2] = new Array("海城,银海,铁山港,合浦")
/*海南*/D[18][0] = new Array("海口市,三亚市,文昌市,琼海市,万宁市,儋州市,东方市,五指山市,保亭县,洋浦经济开发区,其他,定安县,澄迈县")
/*呼和浩特*/D[19][0] = new Array("回民,玉泉,新城,金川开发区,金桥开发区,金山开发区,如意开发区,赛罕,郊区,托克托,清水河,武川,和林格尔,土默特左旗")
/*太原*/D[20][0] = new Array("杏花岭,小店,迎泽,尖草坪,万柏林,晋源,榆次")
/*银川*/D[21][0] = new Array("城区,新城,兴庆区,金凤区,西夏区,永定县,贺兰县,灵武市")
/*兰州*/D[22][0] = new Array("城关,七里河,西固,安宁,红古,永登,榆中,皋兰")
/*西安*/D[23][0] = new Array("城北,城南,城东,城内,城西,高新,长安,临潼,蓝田,阎良,灞桥,咸阳")
/*西宁*/D[24][0] = new Array("城中,城东,城西,城北,湟源,湟中,大通回族土族自治县")
/*武汉*/D[25][0] = new Array("江汉,江岸,?口,汉阳,武昌,洪山,青山,东西湖,黄陂,江夏,阳逻,新洲,蔡甸,汉南,沌口")
/*宜昌*/D[25][1] = new Array("夷陵区,西陵区,伍家岗区,点军区,?亭区,宜都市,当阳市,枝江市,东山开发区,远安县,兴山县,秭归县,长阳土家族自治县,五峰土家族自治县")
/*长沙*/D[26][0] = new Array("岳麓,天心,雨花,开福,芙蓉,星沙,长沙经济开发区")
/*南昌*/D[27][0] = new Array("东湖,西湖,青云谱,湾里,昌北,高新开发区,红谷滩,南昌县,青山湖,新建县,郊区,进贤,安义")
/*昆明*/D[28][0] = new Array("盘龙区,五华区,官渡区,西山区,安宁,呈贡,其他,东川")
/*乌鲁木齐*/D[29][0] = new Array("天山,沙伊巴克,新市,水磨沟,头屯河,南泉,东山")
/*香港*/D[30][0] = new Array("北区,大埔去,东区,观塘区,黄大仙区,九龙城区,葵青区,离岛区,南区,沙田区,屯门区,湾仔区,西贡区,油尖旺区,元朗区,中西区,荃湾区")
/*台北*/D[31][0] = new Array()
///城市与省份的序列对应、每个城市与每个区域数组对应
//创建城市对象,返回一个该城市所在省份及所拥有区域的对象
function createCity(sCityName)
{
var oCity = new Object()
oCity.province = ""
oCity.city = sCityName
oCity.dist = new Array()
oCity.pindex = -1//所属省份在省份数组中的位置index
oCity.cindex = -1//城市在所属城市数组中的位置index(二者用来确定区域数组)
var m = -1var n = -1
for(var i = 0i <C.lengthi++)
{
for(var j=0j <C[i].lengthj++)
{
if(C[i][j] == sCityName)
{
oCity.province = P[i]
oCity.dist = D[i][j]
oCity.pindex = i
oCity.cindex = j
break
}
}
if(oCity.province != "")
{
break
}
}
return oCity
}
/*三级、省、市、区域*/
/*面向对象*/
function oMenu(selProvince,selCity,selDist)
{
///selProvince省份的select控件id
///selCity城市的select控件id
///selDist区域的select控件id
this.oProvince = document.getElementById(selProvince)
///城市变化,初始化区域
function fnInitDist(city)
{
var objCity = createCity(city)
var dist = objCity.dist.toString().split(',')
ClearSelect(selDist,"请选择区域")
InitSelect(selDist,dist,"")
}
///初始化城市
function fnInitCity(province)
{
for(var i = 0i <P.lengthi++)
{
if(P[i] == province)
{
ClearSelect(selCity,"请选择城市")
InitSelect(selCity,C[i],"")
ClearSelect(selDist,"请先选择城市")
document.getElementById(selCity).onchange = function (){fnInitDist(this.value)}
break
}
}
}
///初始化省份
this.fnInitProvince = function(){
InitSelect(selProvince,P,"请选择省份")
ClearSelect(selCity,"请先选择省份")
ClearSelect(selDist,"请先选择城市")
this.oProvince.onchange = function (){fnInitCity(this.value)}
}
///初始化select控件
function InitSelect(obj,aInitValue,sMenu)
{
///obj:要初始化的select控件对象的id
///aInitValue:要初始化的数组值
///sMenu:在select控件头部要添加的option,value为空;如果该参数为空,则只初始化aInitValue而不加头部
if(sMenu != "")
{
document.getElementById(obj).options.add(new Option(sMenu,""))
}
for(var i = 0i <aInitValue.lengthi++)
{
document.getElementById(obj).options.add(new Option(aInitValue[i],aInitValue[i]))
}
}
function ClearSelect(obj,sMenu)
{
document.getElementById(obj).options.length = 0
document.getElementById(obj).options.add(new Option(sMenu,""))
}
}
var oMenu = new oMenu("selProvince","selCity","selDist")//select ID
oMenu.fnInitProvince()
</script>
</body>
</html>