CSDN博客

img lfp1010

省市关联联动下拉代码

发表于2008/10/2 21:43:00  1797人阅读

// JScript 文件

var culturename="zh-CN";//默认设定为中文

function setCultrueName(theCultureName)        //从页面获得文化版本信息
{
culturename=theCultureName;

}

//设置当前下拉选项值为"toLocatevalue"
function locateOptions(theSelect,toLocateValue) {           
  for(i=0,n=theSelect.options.length;i<n;i++)
    if(theSelect.options[i].value==toLocateValue) {
      theSelect.options[i].selected = true;
      break;
    }
}

//设置两关联下拉选框的当前值
function setSelect(parent_select,sub_select,parent_value,sub_value) {
  for(i=0,n=parent_select.options.length;i<n;i++) {
    if(parent_select.options[i].value==parent_value) {
      parent_select.options[i].selected = true;
      fillSelects(parent_select,sub_select,seriesArr,parent_code,parent_desc,sub_code,sub_desc,
     pfield_name_of_sub_data_array,false);
    
   for(j=0,l=sub_select.options.length;j<l;j++) {
     if(sub_select.options[j].value==sub_value) {
       sub_select.options[j].selected = true;
       break;
     }
    }
      break;
    }
  }
}

//清除选项
function clearoptions(obj) {
 obj.options.length = 0;  
}

//向下拉框添加一个选项
function fillSelectOneOption(obj,optionValue,optionDescription){
  clearoptions(obj);
  obj.options.add(new Option(optionDescription,optionValue));
}

//向下拉框添加一组选项
function fillSelect(obj, data, code, description) {
 clearoptions(obj);
 for(i=0,n=data.length;i<n;i++)
     obj.options.add(new Option( eval("data[i]."+description), eval("data[i]."+code) ));
}

//向下拉框增添一选项
function addOption(obj,  code, description) { 
    obj.options.add(new Option( description, code ));
 
}

//向下拉框添加值为"全部"的项
function addAllOption(obj) { 
    obj.options.add(new Option( '全部', ''));
 
}

//向下拉框添加一值为text的选项并设定id
function addOption(obj,text,id) { 
    obj.options.add(new Option( text, id)); 
}

//滤除某些项的方式,填充下拉框
function fillSelectFilterCondition(obj, data, code, description,whereCondition,ifAddAll) {
 clearoptions(obj);
 if(ifAddAll)           //如果添加全部条件成立
       addAllOption(obj);  //添加全部选项
 for(i=0,n=data.length;i<n;i++)
 {
  if( eval(whereCondition) ) //只有当某条件成立
       obj.options.add(new Option( eval("data[i]."+description), eval("data[i]."+code) ));
 }
}

function fillSelectFilterAll(obj, data, code, description,whereCondition,strAll) {
 clearoptions(obj);
        addOption(obj, strAll, '');
 for(i=0,n=data.length;i<n;i++)
 {
  if( eval(whereCondition) )
       obj.options.add(new Option( eval("data[i]."+description), eval("data[i]."+code) ));
 }
}


function fillSelects(html_parent_select,
    html_sub_select,
    pData,
    parent_code_field_name,
    parent_desc_field_name,
    sub_code_field_name,
    sub_desc_field_name,
    list_field_name,
    pre_load) {
 if( (pre_load)&&(null!=pData) ) {
   for(i=0,n=pData.length;i<n;i++) {
     html_parent_select.options.add( new Option(eval("pData[i]."+parent_desc_field_name),
         eval("pData[i]."+parent_code_field_name) ) );
   }
   html_parent_select.options[0].selected = true;
 }

 clearoptions(html_sub_select);

 if(null!=pData) {
  for(i=0,n=pData.length;i<n;i++) {
    var list = eval("pData[i]." + list_field_name);
   if( (null!=list) && (html_parent_select.value == eval("pData[i]."+parent_code_field_name) ) ) {
    if(null!=list) {
       for(j=0,l=list.length;j<l;j++)
        html_sub_select.options.add( new Option( eval("list[j]." + sub_desc_field_name),
            eval("list[j]." + sub_code_field_name) ) );
      }
    break;
   }
  }
 }
}

//==================================================================
//--最新的省市无刷新联动javascript-2008.03.02
var g_selProvince;
var g_selCity;
var Provinces=new Array(
new Array('110000','北京','BeiJing'),
new Array('120000','天津','TianJin'),
new Array('130000','河北','HeBei'),
new Array('140000','山西','ShanXi_'),
new Array('150000','内蒙古','NeiMengGu'),
new Array('210000','辽宁','LiaoNing'),
new Array('220000','吉林','JiLin'),
new Array('230000','黑龙江','HeiLongJiang'),
new Array('310000','上海','ShangHai'),
new Array('320000','江苏','JiangSu'),
new Array('330000','浙江','ZheJiang'),
new Array('340000','安徽','AnHui'),
new Array('350000','福建','FuJian'),
new Array('360000','江西','JiangXi'),
new Array('370000','山东','ShanDong'),
new Array('410000','河南','HeNan'),
new Array('420000','湖北','HuBei'),
new Array('430000','湖南','HuNan'),
new Array('440000','广东','GuangDong'),
new Array('450000','广西','GuangXi'),
new Array('460000','海南','HaiNan'),
new Array('500000','重庆','ChongQing'),
new Array('510000','四川','SiChuan'),
new Array('520000','贵州','GuiZhou'),
new Array('530000','云南','YunNan'),
new Array('540000','西藏','XiZang'),
new Array('610000','陕西','ShanXi'),
new Array('620000','甘肃','GanSu'),
new Array('630000','青海','QingHai'),
new Array('640000','宁夏','NingXia'),
new Array('650000','新疆','XinJiang')
);
var Citys=new Array(
new Array('110100','北京市','BeiJing'),
new Array('120100','天津市','Tianjin'),
new Array('130100','石家庄市','ShiJiaZhuang'),
new Array('130200','唐山市','TangShan'),
new Array('130300','秦皇岛市','QinHuangDao'),
new Array('130400','邯郸市','HanDan'),
new Array('130500','邢台市','XingTai'),
new Array('130600','保定市','BaoDing'),
new Array('130700','张家口市','ZhangJiaKou'),
new Array('130800','承德市','ChengDe'),
new Array('130900','沧州市','CangZhou'),
new Array('131000','廊坊市','LangFang'),
new Array('131100','衡水市','HengShui'),
new Array('140100','太原市','TaiYuan'),
new Array('140200','大同市','DaTong'),
new Array('140300','阳泉市','YangQuan'),
new Array('140400','长治市','ChangZhi'),
new Array('140500','晋城市','JinCheng'),
new Array('140600','朔州市','ShuoZhou'),
new Array('140700','晋中市','JinZhong'),
new Array('140800','运城市','YunCheng'),
new Array('140900','忻州市','XinZhou'),
new Array('141000','临汾市','LinFen'),
new Array('141100','吕梁市','LvLiang'),
new Array('150100','呼和浩特市','HuHeHaoTe'),
new Array('150200','包头市','BaoTou'),
new Array('150300','乌海市','WuHai'),
new Array('150400','赤峰市','ChiFeng'),
new Array('150500','通辽市','TongLiao'),
new Array('150600','鄂尔多斯市','EErDuoSi'),
new Array('150700','呼伦贝尔市','HuLunBeiEr'),
new Array('150800','巴彦淖尔市','BaYanNaoEr'),
new Array('150900','乌兰察布市','WuLanChaBu'),
new Array('152200','兴安盟','XingAnMeng'),
new Array('152500','锡林郭勒盟','XiLinGuoLeMeng'),
new Array('152900','阿拉善盟','ALaShanMeng'),
new Array('210100','沈阳市','ShenYang'),
new Array('210200','大连市','DaLian'),
new Array('210300','鞍山市','AnShan'),
new Array('210400','抚顺市','FuShun'),
new Array('210500','本溪市','BenXi'),
new Array('210600','丹东市','DanDong'),
new Array('210700','锦州市','JinZhou'),
new Array('210800','营口市','YingKou'),
new Array('210900','阜新市','FuXin'),
new Array('211000','辽阳市','LiaoYang'),
new Array('211100','盘锦市','PanJin'),
new Array('211200','铁岭市','TieLing'),
new Array('211300','朝阳市','ZhaoYang'),
new Array('211400','葫芦岛市','HuLuDao'),
new Array('220100','长春市','ChangChun'),
new Array('220200','吉林市','JiLin'),
new Array('220300','四平市','SiPing'),
new Array('220400','辽源市','LiaoYuan'),
new Array('220500','通化市','TongHua'),
new Array('220600','白山市','BaiShan'),
new Array('220700','松原市','SongYuan'),
new Array('220800','白城市','BaiCheng'),
new Array('222400','延边朝鲜族自治州','YanBianChaoXianZu'),
new Array('230100','哈尔滨市','HaErBin'),
new Array('230200','齐齐哈尔市','QiQiHaEr'),
new Array('230300','鸡西市','JiXi'),
new Array('230400','鹤岗市','HeGang'),
new Array('230500','双鸭山市','ShuangYaShan'),
new Array('230600','大庆市','DaQing'),
new Array('230700','伊春市','YiChun'),
new Array('230800','佳木斯市','JiaMuSi'),
new Array('230900','七台河市','QiTaiHe'),
new Array('231000','牡丹江市','MuDanJiang'),
new Array('231100','黑河市','HeiHe'),
new Array('231200','绥化市','SuiHua'),
new Array('232700','大兴安岭地区(加格达奇)','DaXingAnLing(JiaGeDaQi)'),
new Array('310100','上海市','ShangHai'),
new Array('320100','南京市','NanJing'),
new Array('320200','无锡市','WuXi'),
new Array('320300','徐州市','XuZhou'),
new Array('320400','常州市','ChangZhou'),
new Array('320500','苏州市','SuZhou'),
new Array('320600','南通市','NanTong'),
new Array('320700','连云港市','LianYunGang'),
new Array('320800','淮安市','HuaiAn'),
new Array('320900','盐城市','YanCheng'),
new Array('321000','扬州市','YangZhou'),
new Array('321100','镇江市','ZhenJiang'),
new Array('321200','泰州市','TaiZhou'),
new Array('321300','宿迁市','SuQian'),
new Array('330100','杭州市','HangZhou'),
new Array('330200','宁波市','NingBo'),
new Array('330300','温州市','WenZhou'),
new Array('330400','嘉兴市','JiaXing'),
new Array('330500','湖州市','HuZhou'),
new Array('330600','绍兴市','ShaoXing'),
new Array('330700','金华市','JinHua'),
new Array('330800','衢州市','QuZhou'),
new Array('330900','舟山市','ZhouShan'),
new Array('331000','台州市','TaiZhou'),
new Array('331100','丽水市','LiShui'),
new Array('340100','合肥市','HeFei'),
new Array('340200','芜湖市','WuHu'),
new Array('340300','蚌埠市','BengBu'),
new Array('340400','淮南市','HuaiNan'),
new Array('340500','马鞍山市','MaAnShan'),
new Array('340600','淮北市','HuaiBei'),
new Array('340700','铜陵市','TongLing'),
new Array('340800','安庆市','AnQing'),
new Array('341000','黄山市','HuangShan'),
new Array('341100','滁州市','ChuZhou'),
new Array('341200','阜阳市','FuYang'),
new Array('341300','宿州市','SuZhou'),
new Array('341400','巢湖市','ChaoHu'),
new Array('341500','六安市','LiuAn'),
new Array('341600','亳州市','HaoZhou'),
new Array('341700','池州市','ChiZhou'),
new Array('341800','宣城市','XuanCheng'),
new Array('350100','福州市','FuZhou'),
new Array('350200','厦门市','XiaMen'),
new Array('350300','莆田市','BuTian'),
new Array('350400','三明市','SanMing'),
new Array('350500','泉州市','QuanZhou'),
new Array('350600','漳州市','ZhangZhou'),
new Array('350700','南平市','NanPing'),
new Array('350800','龙岩市','LongYan'),
new Array('350900','宁德市','NingDe'),
new Array('360100','南昌市','NanChang'),
new Array('360200','景德镇市','JingDeZhen'),
new Array('360300','萍乡市','PingXiang'),
new Array('360400','九江市','JiuJiang'),
new Array('360500','新余市','XinYu'),
new Array('360600','鹰潭市','YingTan'),
new Array('360700','赣州市','GanZhou'),
new Array('360800','吉安市','JiAn'),
new Array('360900','宜春市','YiChun'),
new Array('361000','抚州市','FuZhou'),
new Array('361100','上饶市','ShangRao'),
new Array('370100','济南市','JiNan'),
new Array('370200','青岛市','QingDao'),
new Array('370300','淄博市','ZiBo'),
new Array('370400','枣庄市','ZaoZhuang'),
new Array('370500','东营市','DongYing'),
new Array('370600','烟台市','YinTai'),
new Array('370700','潍坊市','WeiFang'),
new Array('370800','济宁市','JiNing'),
new Array('370900','泰安市','TaiAn'),
new Array('371000','威海市','WeiHai'),
new Array('371100','日照市','RiZhao'),
new Array('371200','莱芜市','LaiWu'),
new Array('371300','临沂市','LinYi'),
new Array('371400','德州市','DeZhou'),
new Array('371500','聊城市','LiaoCheng'),
new Array('371600','滨州市','BinZhou'),
new Array('371700','菏泽市','HeZe'),
new Array('410100','郑州市','ZhengZhou'),
new Array('410200','开封市','KaiFeng'),
new Array('410300','洛阳市','LuoYang'),
new Array('410400','平顶山市','PingDingShan'),
new Array('410500','安阳市','AnYang'),
new Array('410600','鹤壁市','HeBi'),
new Array('410700','新乡市','XinXiang'),
new Array('410800','焦作市','JiaoZuo'),
new Array('410900','濮阳市','PuYang'),
new Array('411000','许昌市','XuChang'),
new Array('411100','漯河市','LuoHe'),
new Array('411200','三门峡市','SanMenXia'),
new Array('411300','南阳市','NanYang'),
new Array('411400','商丘市','ShangQiu'),
new Array('411500','信阳市','XinYang'),
new Array('411600','周口市','ZhouKou'),
new Array('411700','驻马店市','ZhuMaDian'),
new Array('420100','武汉市','WuHan'),
new Array('420200','黄石市','HuangShi'),
new Array('420300','十堰市','ShiYan'),
new Array('420500','宜昌市','YiChang'),
new Array('420600','襄樊市','XiangFan'),
new Array('420700','鄂州市','EZhou'),
new Array('420800','荆门市','JingMen'),
new Array('420900','孝感市','XiaoGan'),
new Array('421000','荆州市','JingZhou'),
new Array('421100','黄冈市','HuangGang'),
new Array('421200','咸宁市','XianNing'),
new Array('421300','随州市','SuiZhou'),
new Array('422800','恩施土家族苗族自治州','EnShiTuJiaZuMiaoZu'),
new Array('429000','省直辖县级行政单位','ShengZhiXiaXianJiXingZhengDanWei'),
new Array('430100','长沙市','ChangSha'),
new Array('430200','株洲市','ZhuZhou'),
new Array('430300','湘潭市','XiangTan'),
new Array('430400','衡阳市','HengYang'),
new Array('430500','邵阳市','ShaoYang'),
new Array('430600','岳阳市','YueYang'),
new Array('430700','常德市','ChangDe'),
new Array('430800','张家界市','ZhangJiaJie'),
new Array('430900','益阳市','YiYang'),
new Array('431000','郴州市','ChenZhou'),
new Array('431100','永州市','YongZhou'),
new Array('431200','怀化市','HuaiHua'),
new Array('431300','娄底市','LouDi'),
new Array('433100','湘西土家族苗族自治州','XiangXiTuJiaZuMiaoZu'),
new Array('440100','广州市','GuangZhou'),
new Array('440200','韶关市','ShaoGuan'),
new Array('440300','深圳市','ShenZhen'),
new Array('440400','珠海市','ZhuHai'),
new Array('440500','汕头市','ShanTou'),
new Array('440600','佛山市','FoShan'),
new Array('440700','江门市','JiangMen'),
new Array('440800','湛江市','ZhanJiang'),
new Array('440900','茂名市','MaoMing'),
new Array('441200','肇庆市','ZhaoQing'),
new Array('441300','惠州市','HuiZhou'),
new Array('441400','梅州市','MeiZhou'),
new Array('441500','汕尾市','ShanWei'),
new Array('441600','河源市','HeYuan'),
new Array('441700','阳江市','YangJiang'),
new Array('441800','清远市','QingYuan'),
new Array('441900','东莞市','DongGuan'),
new Array('442000','中山市','ZhongShan'),
new Array('445100','潮州市','ChaoZhou'),
new Array('445200','揭阳市','JieYang'),
new Array('445300','云浮市','YunFu'),
new Array('450100','南宁市','NanNing'),
new Array('450200','柳州市','LiuZhou'),
new Array('450300','桂林市','GuiLin'),
new Array('450400','梧州市','WuZhou'),
new Array('450500','北海市','BeiHai'),
new Array('450600','防城港市','FangChengGang'),
new Array('450700','钦州市','QinZhou'),
new Array('450800','贵港市','GuiGang'),
new Array('450900','玉林市','YuLin'),
new Array('451000','百色市','BaiSe'),
new Array('451100','贺州市','HeZhou'),
new Array('451200','河池市','HeChi'),
new Array('451300','来宾市','LaiBin'),
new Array('451400','崇左市','ChongZuo'),
new Array('460100','海口市','HaiKou'),
new Array('460200','三亚市','SanYa'),
new Array('469000','省直辖行政单位','ShengZhiXiaXingZhengDanWei'),
new Array('500100','重庆市','ChongQing'),
new Array('510100','成都市','ChengDou'),
new Array('510300','自贡市','ZiGong'),
new Array('510400','攀枝花市','PanZhiHua'),
new Array('510500','泸州市','LuZhou'),
new Array('510600','德阳市','DeYang'),
new Array('510700','绵阳市','MianYang'),
new Array('510800','广元市','GuangYuan'),
new Array('510900','遂宁市','SuiNing'),
new Array('511000','内江市','NeiJiang'),
new Array('511100','乐山市','LeShan'),
new Array('511300','南充市','NanChong'),
new Array('511400','眉山市','MeiShan'),
new Array('511500','宜宾市','YiBin'),
new Array('511600','广安市','GuangAn'),
new Array('511700','达州市','DaZhou'),
new Array('511800','雅安市','YaAn'),
new Array('511900','巴中市','BaZhong'),
new Array('512000','资阳市','ZiYang'),
new Array('513200','阿坝藏族羌族自治州','ABaZangZuQiangZu'),
new Array('513300','甘孜藏族自治州','GanZiZangZu'),
new Array('513400','凉山彝族自治州','LiangShanYiZu'),
new Array('520100','贵阳市','GuiYang'),
new Array('520200','六盘水市','LiuPanShui'),
new Array('520300','遵义市','ZunYi'),
new Array('520400','安顺市','AnShun'),
new Array('522200','铜仁地区','TongRen'),
new Array('522300','黔西南布依族苗族自治州','QianXiNanBuYiZuMiaoZu'),
new Array('522400','毕节地区','BiJie'),
new Array('522600','黔东南苗族侗族自治州','QianDongNanMiaoZuDongZu'),
new Array('522700','黔南布依族苗族自治州','QianNanBuYiZuMiaoZu'),
new Array('530100','昆明市','KunMing'),
new Array('530300','曲靖市','QuJing'),
new Array('530400','玉溪市','YuXi'),
new Array('530500','保山市','BaoShan'),
new Array('530600','昭通市','ZhaoTong'),
new Array('530700','丽江市','LiJiang'),
new Array('530800','思茅市','SiMao'),
new Array('530900','临沧市','LinCang'),
new Array('532300','楚雄彝族自治州','ChuXiongYiZu'),
new Array('532500','红河哈尼族彝族自治州','HongHeHaNiZuYiZu'),
new Array('532600','文山壮族苗族自治州','WenShanZhuangZuMiaoZu'),
new Array('532800','西双版纳傣族自治州','XiShuangBanNaDaiZu'),
new Array('532900','大理白族自治州','DaLiBaiZu'),
new Array('533100','德宏傣族景颇族自治州','DeHongDaiZuJingPoZu'),
new Array('533300','怒江傈僳族自治州(泸水县六库镇)','NuJiangLiSuZu'),
new Array('533400','迪庆藏族自治州','DiQingZangZu'),
new Array('540100','拉萨市','LaSa'),
new Array('542100','昌都地区','ChangDou'),
new Array('542200','山南地区','ShanNan'),
new Array('542300','日喀则地区','RiKaZe'),
new Array('542400','那曲地区','NaQu'),
new Array('542500','阿里地区','ALi'),
new Array('542600','林芝地区(林芝县八一镇)','LinZhi'),
new Array('610100','西安市','XiAn'),
new Array('610200','铜川市','TongChuan'),
new Array('610300','宝鸡市','BaoJi'),
new Array('610400','咸阳市','XianYang'),
new Array('610500','渭南市','WeiNan'),
new Array('610600','延安市','YanAn'),
new Array('610700','汉中市','HanZhong'),
new Array('610800','榆林市','YuLin'),
new Array('610900','安康市','AnKang'),
new Array('611000','商洛市','ShangLuo'),
new Array('620100','兰州市','LanZhou'),
new Array('620200','嘉峪关市','JiaYuGuan'),
new Array('620300','金昌市','JinChang'),
new Array('620400','白银市','BaiYin'),
new Array('620500','天水市','TianShui'),
new Array('620600','武威市','WuWei'),
new Array('620700','张掖市','ZhangYe'),
new Array('620800','平凉市','PingLiang'),
new Array('620900','酒泉市','JiuQuan'),
new Array('621000','庆阳市','QingYang'),
new Array('621100','定西市','DingXi'),
new Array('621200','陇南市','LongNan'),
new Array('622900','临夏回族自治州','LinXiaHuiZu'),
new Array('623000','甘南藏族自治州','GanNanZangZu'),
new Array('630100','西宁市','XiNing'),
new Array('632100','海东地区','HaiDong'),
new Array('632200','海北藏族自治州(海晏县西海镇)','HaiBeiZangZu'),
new Array('632300','黄南藏族自治州','HuangNanZangZu'),
new Array('632500','海南藏族自治州','HaiNanZangZu'),
new Array('632600','果洛藏族自治州','GuoLuoZangZu'),
new Array('632700','玉树藏族自治州','YuShuZangZu'),
new Array('632800','海西蒙古族藏族自治州','HaiXiMengGuZuZangZu'),
new Array('640100','银川市','YinChuan'),
new Array('640200','石嘴山市','ShiZuiShan'),
new Array('640300','吴忠市','WuZhong'),
new Array('640400','固原市','GuYuan'),
new Array('640500','中卫市','ZhongWei'),
new Array('650100','乌鲁木齐市','WuLuMuQi'),
new Array('650200','克拉玛依市','KeLaMaYi'),
new Array('652100','吐鲁番地区','TuLuFan'),
new Array('652200','哈密地区','HaMi'),
new Array('652300','昌吉回族自治州','ChangJiHuiZu'),
new Array('652700','博尔塔拉蒙古自治州','BoErTaLaMengGu'),
new Array('652800','巴音郭楞蒙古自治州','BaYinGuoLengMengGu'),
new Array('652900','阿克苏地区','AKeSu'),
new Array('653000','克孜勒苏柯尔克孜自治州','KeZiLeSuKeErKeZi'),
new Array('653100','喀什地区','KaShi'),
new Array('653200','和田地区','HeTian'),
new Array('654000','伊犁哈萨克自治州','YiLiHaSaKe'),
new Array('654200','塔城地区','TaCheng'),
new Array('654300','阿勒泰地区','ALeTai'),
new Array('659000','自治区直辖县级行政单位','ZiZhiQuZhiXiaXianJiXingZhengDanWei')
);

function FillProvinces(selProvince, strAll)

    //--添加“全部”选项
    selProvince.options[0]=new Option(strAll,'');
    //********modified by LFP 20080829 Begin
    if(culturename=="en-US") //如果为英语
    {  for(i=0;i<Provinces.length;i++)
        {
            selProvince.options[i+1]=new Option(Provinces[i][2],Provinces[i][0]);
        }
    }
    else  //否则为中文
    {
        for(i=0;i<Provinces.length;i++)
        {
            selProvince.options[i+1]=new Option(Provinces[i][1],Provinces[i][0]);
        }
    }
      //********modified by LFP 20080829 End
   
    selProvince.options[0].selected=true;
    selProvince.length=i+1;
}

function FillCitys(selCity,ProvinceCode,strAll)
{

    
    
    //if the province is a direct-managed city, like Beijing, shanghai, tianjin, chongqin,hongkong, macro
        //need not "请选择选项"
        if(ProvinceCode=="110000"||ProvinceCode=="120000"||ProvinceCode=="310000"
                 ||ProvinceCode=="810000"||ProvinceCode=="820000"||ProvinceCode=="500000")
             count=0;
        else
                {selCity.options[0]=new Option(strAll,'');
                count=1;}
    for(i=0;i<Citys.length;i++)
    {
        if(Citys[i][0].toString().substring(0,2)==ProvinceCode.substring(0,2))
        {
          if(culturename=="en-US")
            selCity.options[count]=new Option(Citys[i][2],Citys[i][0]);
          else
            selCity.options[count]=new Option(Citys[i][1],Citys[i][0]);
            count=count+1;
        }
    }
    selCity.options[0].selected=true;
    selCity.length=count;
}

function Province_onchange(strAll)
{
    FillCitys(g_selCity,g_selProvince.value,strAll);
}

function InitCitySelect(selProvince,selCity, strAll)
{
 
 
    //alert("begin");
    g_selProvince=selProvince;
    g_selCity=selCity;
    selProvince.onchange=Function("Province_onchange('"+ strAll +"');");
    FillProvinces(selProvince, strAll);
    Province_onchange(strAll);
}
/*
function InitCitySelect2(selProvince,selCity,CityCode)
{
    InitCitySelect(selProvince,selCity)
    for(i=0;i<selProvince.length;i++)
    {
        if(selProvince.options[i].value.substring(0,2)==CityCode.substring(0,2))
        {
            selProvince.options[i].selected=true;
        }
    }
    Province_onchange();
    for(i=0;i<selCity.length;i++)
    {
        if(selCity.options[i].value==CityCode)
        {
            selCity.options[i].selected=true;
        }
    }
}
*/

0 0

相关博文

我的热门文章

img
取 消
img