字节数最小的中国城市JavaScrip列表(转)
2008-01-05 09:41:33 来源:WEB开发网核心提示:字节数最小的中国城市javaScrip列表 (01-5-29 313) asp精品屋 红头绳 2001-5-28在电子商务或一些ASP应用程序中,经常要用到地区的选择,字节数最小的中国城市JavaScrip列表(转),中国有35个省或市或地区,我们在选择一个省市,从此浏览速度大大改观,网站也用不着改变省就要重复刷新,希
字节数最小的中国城市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);