一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

字节数最小的中国城市JavaScrip列表(转)

时间:2022-06-30 09:42:44 编辑:袖梨 来源:一聚教程网

字节数最小的中国城市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("请选择","和平区","河东区","河西区","南开区","河北区","红桥区","塘沽区","汉沽区","大港
区","东丽区","西青区","津南区","北辰区","郊县","其他地区");

热门栏目