字节数最小的中国城市JavaScrip列表
作者:cmscn 日期:2007-01-07
在电子商务或一些ASP应用程序中,经常要用到地区的选择。
中国有35个省或市或地区,我们在选择一个省市,希望能够立即弹出对应的省以供选择。这功能可以用javascript来
实现。但是中国拥有非常纵多的城市,如果用JavaScript起来,将会是一个不小的JavaScript,像ChinaBig的网站的选择下
拉框对应的JS内容竟有38.5K 之多,严重影响了网页的浏览速度。今日我对这些数据进行了重组,直接用数据赋值,并将
变量名改为一个字母,数据减小到只有7670 Bytes。从此浏览速度大大改观,网站也用不着改变省就要重复刷新, 而代
价仅仅是这7670个字节。
下面是City.JS的内容.
I=new Array;
N=new Array;
I[03]=new Array(0,500,501,502,503,504,505,506,507,508,509,510,511);
N[03]=new Array("请选择","东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区","海淀区","门头沟
区","房山区","郊县","其他地区");
I[26]=new Array(0,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595);
N[26]=new Array("请选择","黄浦区","南市区","卢湾区","徐汇区","长宁区","静安区","普陀区","闸北区","虹口
区","杨浦区","闵行区","宝山区","郊县","嘉定区","浦东新区","其他地区");
I[29]=new Array(0,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614);
N[29]=new Array("请选择","和平区","河东区","河西区","南开区","河北区","红桥区","塘沽区","汉沽区","大港
区","东丽区","西青区","津南区","北辰区","郊县","其他地区");
I[35]=new Array(0,638,639,640,641,642);
N[35]=new Array("请选择","涪陵区","万州区","黔江地区","市区","其他地区");
I[34]=new Array(0,637,1,3,4,5,6,17,18,21,23,24,25);
N[34]=new Array("请选择","其他地区","温州市","杭州市","宁波市","嘉兴市","绍兴市","丽水地区","湖州市","金华
市","台州市","舟山市","衢州市");
I[07]=new Array(0,86,89,90,92,93,94,96,97,520,521,522,523,524,525);
N[07]=new Array("请选择","北海市","桂林市","河池地区","柳州市","南宁市","钦州市","梧州市","玉林地区","防城
港市","南宁地区","柳州地区","桂林地区","梧州地区","其他地区");
I[08]=new Array(0,526,527,528,529,530,532,533,534,100,101);
N[08]=new Array("请选择","黔东南苗族侗族自治州","黔西南布依族苗族自治州","黔南布依族苗族自治州","遵义地
区","铜仁地区","毕节地区","安顺地区","其他地区","贵阳市","六盘水市");
I[09]=new Array(0,107,535);
N[09]=new Array("请选择","海南","其他地区");
I[10]=new Array(0,536,644,110,112,114,115,116,117,118,120,121,123,125);
N[10]=new Array("请选择","其他地区","保定市","保定地区","沧州市","承德市","邯郸市","衡水地区","廊坊市","秦
皇岛市","石家庄市","唐山市","邢台市","张家口市");
I[11]=new Array(0,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,537);
N[11]=new Array("请选择","安阳市","鹤壁市","焦作市","开封市","洛阳市","南阳市","平顶山市","三门峡市","商丘
地区","新乡市","信阳地区","许昌市","郑州市","周口地区","驻马店地区","漯河市","濮阳市","其他地区");
I[12]=new Array(0,538,539,540,541,143,145,146,148,149,152,153,155,156,158,159);
N[12]=new Array("请选择","黑河市","七台河市","松花江地区","大兴安岭地区","其他地区","哈尔滨市","鹤岗市","大
庆市","鸡西市","佳木斯市","牡丹江市","齐齐哈尔市","双鸭山市","绥化地区","伊春市");
I[13]=new Array(0,160,161,163,164,167,168,169,170,171,172,542,543,497);
N[13]=new Array("请选择","鄂州市","恩施土家族苗族自治州","黄石市","荆门市","武汉市","咸宁地区","襄樊市","黄
冈地区","孝感市","宜昌市","荆沙市","其他地区","十堰市");
I[14]=new Array(0,544,545,643,175,176,177,179,180,181,182,183,184,186,187,188);
N[14]=new Array("请选择","张家界市","湘西土家族苗族自治州","其他地区","常德市","长沙市","郴州市","怀化地
区","衡阳市","零陵地区","娄底地区","邵阳市","湘潭市","益阳市","岳阳市","株洲市");
I[15]=new Array(0,190,192,194,195,196,198,199,547,548,549);
N[15]=new Array("请选择","白城市","长春市","吉林市","辽源市","四平市","通化市","延边朝鲜族自治州","白山
市","松原市","其他地区");
I[16]=new Array(0,645,550,200,201,202,203,204,205,206,207,208,209,210);
N[16]=new Array("请选择","常熟市","其他地区","常州市","淮阴市","连云港市","南京市","南通市","苏州市","无锡
市","徐州市","盐城市","扬州市","镇江市");
I[17]=new Array(0,211,212,213,214,215,216,217,218,219,220,221,551);
N[17]=new Array("请选择","抚州地区","赣州地区","吉安地区","景德镇市","九江市","南昌市","萍乡市","上饶地
区","新余市","宜春地区","鹰潭市","其他地区");
I[18]=new Array(0,552,222,223,224,225,226,227,228,229,230,231,232,233,234,235);
N[18]=new Array("请选择","其他地区","鞍山市","本溪市","朝阳市","大连市","丹东市","抚顺市","阜新市","锦西
市","锦州市","辽阳市","盘锦市","沈阳市","铁岭市","营口市");
I[19]=new Array(0,238,239,240,242,553,554,555,556,557,558,559,560,561);
N[19]=new Array("请选择","包头市","赤峰市","呼和浩特市","乌海市","呼伦贝尔盟","兴安盟","哲里木盟","锡林郭勒
盟","乌兰察布盟","伊克昭盟","巴彦淖尔盟","阿拉善盟","其他地区");
I[20]=new Array(0,562,563,565,249,250);
N[20]=new Array("请选择","固原地区","银南地区","其他地区","石嘴山市","银川市");
I[22]=new Array(0,256,259,566,567,568,569,570,571,572);
N[22]=new Array("请选择","玉树藏族自治州","西宁市","海东地区","黄南藏族自治州","果洛藏族自治州","海西蒙古族
藏族自治州","海南藏族自治州","海北藏族自治州","其他地区");
I[24]=new Array(0,349,350,351,353,355,356,359,360,574,575,576,577);
N[24]=new Array("请选择","长治市","大同市","晋城市","临汾地区","忻州地区","太原市","阳泉市","运城地区","朔
州市","吕梁地区","晋中地区","其他地区");
I[25]=new Array(0,578,579,361,362,363,365,366,367,368,369,370);
N[25]=new Array("请选择","商洛地区","其他地区","安康地区","宝鸡市","汉中地区","铜川市","渭南市","西安
市","咸阳市","延安地区","榆林地区");
I[01]=new Array(0,499,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41);
N[01]=new Array("请选择","其他地区","安庆市","蚌埠市","巢湖地区","池州地区","滁州市","阜阳地区","合肥
市","淮北市","淮南市","黄山市","六安地区","马鞍山市","宿县地区","铜陵市","芜湖市","宣城地区");
I[27]=new Array(0,373,374,375,376,379,380,381,382,383,384,385,386,387,388,389,390,599,596,597,598);
N[27]=new Array("请选择","凉山彝族自治州","成都市","达川地区","德阳市","广元市","乐山市","甘孜藏族自治
州","绵阳市","南充市","内江市","攀枝花市","遂宁市","雅安地区","宜宾地区","自贡市","泸州市","其他地区","阿坝
藏族羌族自治州","巴中地区","广安地区");
I[04]=new Array(0,435,512,42,43,44,46,47,48,49,51);
N[04]=new Array("请选择","宁德地区","其他地区","福州市","龙岩地区","南平市","蒲田市","泉州市","三明市","厦
门市","漳州市");
I[32]=new Array(0,407,408,411,412,400,401,404,405,406,618,619,620,621,622,623,624,625);
N[32]=new Array("请选择","喀什地区","克拉玛依市","吐鲁番地区","乌鲁木齐市","阿克苏地区","阿勒泰地区","昌吉
回族自治州","哈密地区","和田地区","石河子市","博尔塔拉蒙古自治州","巴音郭楞蒙古自治州","克孜勒苏柯尔克孜自
治州","伊犁哈萨克自治州","伊犁地区","塔城地区","其他地区");
I[30]=new Array(0,617,615,616,397,398,393,394,395);
N[30]=new Array("请选择","其他地区","那曲地区","阿里地区","日喀则地区","山南地区","昌都地区","拉萨市","林芝
地区");
I[33]=new Array(0,414,415,416,419,421,425,429,430,626,627,628,629,630,636,632,633,634,635);
N[33]=new Array("请选择","保山地区","楚雄彝族自治州","大理白族自治州","东川市","昆明市","曲靖地区","玉溪地
区","昭通地区","红河哈尼族彝族自治州","文山壮族苗族自治州","思茅地区","西双版纳傣族自治州","德宏傣族景颇族
自治州","其他地区","丽江地区","怒江傈僳族自治州","迪庆藏族自治州","临沧地区");
I[06]=new Array(0,516,517,518,519,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,13,83,84);
N[06]=new Array("请选择","揭阳市","云浮市","顺德市","其他地区","潮州市","东莞市","佛山市","河源市","惠州
市","江门市","茂名市","梅州市","清远市","汕头市","汕尾市","韶关市","深圳市","阳江市","湛江市","肇庆市","广
州市","中山市","珠海市");
I[05]=new Array(0,52,53,54,55,56,57,58,59,61,63,64,65,513,514,515);
N[05]=new Array("请选择","白银市","定西地区","甘南藏族自治州","嘉峪关市","金昌市","酒泉地区","兰州市","临夏
回族自治州","平凉地区","天水市","武威地区","张掖地区","庆阳地区","陇南地区","其他地区");
I[21]=new Array(0,646);
N[21]=new Array("请选择","其他");
I[23]=new Array(0,573,345,346,347,348,332,333,334,335,336,337,338,339,340,341,342,343,344);
N[23]=new Array("请选择","其他地区","潍坊市","烟台市","枣庄市","淄博市","滨州地区","德州市","东营市","菏泽
地区","济南市","济宁市","莱芜市","聊城地区","临沂市","青岛市","日照市","泰安市","威海市");
I[28]=new Array(0,648);
N[28]=new Array("请选择","其他地区");
I[31]=new Array(0,649,399);
N[31]=new Array("请选择","其他地区","香港");
I[02]=new Array(0,431,647);
N[02]=new Array("请选择","澳门","其他地区");
评论: 6 | 引用: 0 | 查看次数: 805
发表评论