字节数最小的中国城市JavaScrip列表
(01-5-29 313)
ASP精品屋 红头绳 2001-5-28
在电子商务或一些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("请选择","黑河市",&qu