用 JS 动态载入 省份 和 城市
今天共享2个文件,使用 JavaScript 做一个 动态载入 省份 城市级联的效果。
给新手参考的资料代码, 但请尊重原创的劳动成果。 废话不多说, 分享代码如下:
现有创建一个 名字为: jsProvinceLineCity.js 文件。
[javascript]
var _city=new Array(35);
_city[0]=new Array(["请选择省份","请先选择省份"],[0,0]);
_city[1]=new Array(["北京","北京"],[2,201]);
_city[2]=new Array(["重庆","重庆"],[3,301]);
_city[3]=new Array(["福建","福州市","龙岩地区","南平地区","宁德地区","莆田市","泉州市","三明市","厦门市","漳州市"],[4,401,402,403,404,405,406,407,408,409]);
_city[4]=new Array(["甘肃","白银市","定西地区","甘南藏族自治州","嘉峪关市","金昌市","酒泉地区","兰州市","临夏易做图自治州","陇南地区","平凉地区","庆阳地区","天水市","武威地区","张掖地区"],[5,501,502,503,504,505,506,507,508,509,510,511,512,513,514]);
_city[5]=new Array(["广东","潮州市","东莞市","佛山市","广州市","河源市","惠州市","江门市","揭阳市","茂名市","梅州市","清远市","汕头市","汕尾市","韶关市","深圳市","阳江市","湛江市","肇庆市","中山市","珠海市"],[6,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620]);
_city[6]=new Array(["广西","百色地区","北海市","桂林地区","桂林市","河池地区","柳州地区","柳州市","南宁地区","南宁市","钦州地区","梧州地区","梧州市","玉林地区"],[7,701,702,703,704,705,706,707,708,709,710,711,713]);
_city[7]=new Array(["贵州","安顺地区","毕节地区","贵阳市","六盘水市","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","铜仁地区","遵义地区"],[8,801,802,803,804,805,806,807,808,809]);
_city[8]=new Array(["海南","白沙黎族自治县","保亭黎族苗族自治县","昌江黎族自治县","澄迈县","儋县","定安县","东方黎族自治县","海口市","乐东黎族自治县","临高县","陵水黎族自治县","南沙群岛","琼海市","琼山县","琼中黎族苗族自治县","三亚市","通什市","屯昌县","万宁县","文昌县","西沙群岛","中沙群岛的岛礁及其海域"],[9,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922]);
_city[9]=new Array(["安徽","安庆市","蚌埠市","巢湖地区","池州地区","滁州市","阜阳地区","合肥市","淮北市","淮南市","黄山市","六安地区","马鞍山市","宿县地区","铜陵市","芜湖市","宣城地区"],[1,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116]);
_city[10]=new Array(["河北","保定地区","保定市","沧州地区","沧州市","承德地区","承德市","邯郸地区","邯郸市","衡水地区","廊坊市","秦皇岛市","石家庄地区","石家庄市","唐山市","邢台地区","邢台市","张家口地区","张家口市"],[10,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022]);
_city[11]=new Array(["河南","安阳市","鹤壁市","焦作市","开封市","洛阳市","漯河市","南阳地区","平顶山市","濮阳市","三门峡市","商丘地区","新乡市","信阳地区","许昌市","郑州市","周口地区","驻马店地区"],[11,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122]);
_city[12]=new Array(["黑龙江","大庆市","大兴安岭地区","哈尔滨市","鹤岗市","黑河地区","鸡西市","佳木斯市","牡丹江市","七台河市","齐齐哈尔市","双鸭山市","松花江地区","绥化地区","伊春市"],[12,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222]);
_city[13]=new Array(["湖北","鄂西土家族苗族自治州","鄂州市","黄冈地区","黄石市","荆门市","荆州地区","沙市市","省直辖行政单位","十堰市","武汉市","咸宁地区","襄樊市","孝感地区","宜昌市","郧阳地区"],[13,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322]);
_city[14]=new Array(["湖南","长沙市","常德市","郴州地区","大庸市","衡阳市","怀化地区","零陵地区","娄底地区","邵阳市","湘潭市","湘西土家族苗族自治州","益阳地区","岳阳市","株洲市"],[14,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422]);
_city[15]=new Array(["吉林","白城地区","长春市","浑江市","吉林市","辽源市","四平市","松原市","通化市","延边朝鲜族自治州"],[15,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522]);
_city[16]=new Array(["江苏","常州市","淮阴市","连云港市","南京市","南通市","苏州市","无锡市","徐州市","盐城市","扬州市","镇江市"],[16,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622]);
_city[17]=new Array(["江西","抚州地区","赣州地区","吉安地区","景德镇市","九江市","南昌市","萍乡市","上饶地区","新余市","宜春地区","鹰潭市"],[17,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722]);
_city[18]=new Array(["辽宁","鞍山市","本溪市","朝阳市","大连市","丹东市","抚顺市","阜新市","锦西市","锦州市","辽阳市","盘锦市","沈阳市","铁岭市","营口市"],[18,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822]);
_city[19]=new Array(["内蒙古","阿拉善盟","巴彦淖尔盟","包头市","赤峰市","呼和浩特市","呼伦贝尔盟","乌海市","乌兰察布盟","锡林郭勒盟","兴安盟","伊克昭盟","哲里木盟"],[19,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922]);
_city[20]=new Array(["宁夏"
补充:web前端 , JavaScript ,