本人写的地区js

function redirect(x,form1){//此地区及联只有省与市
          // var objform =document.getElementsByTagName(form1);
          var objform=document.getElementById(form1);
          // alert(objform.provinces);
    var groups=objform.provinces.options.length
    group=new Array(groups)
    for (i=0; i       group[i]=new Array()
       //上海
   group[0][0]=new Option("宝山","宝山")
   group[0][1]=new Option("金山","金山")
   group[0][2]=new Option("长宁","长宁")
   group[0][3]=new Option("静安","静安")
   group[0][4]=new Option("青浦","青浦")
   group[0][5]=new Option("崇明","崇明")
   group[0][6]=new Option("卢湾","卢湾")
   group[0][7]=new Option("奉贤","奉贤")
   group[0][8]=new Option("浦东","浦东")
   group[0][9]=new Option("杨浦","杨浦")
   group[0][10]=new Option("虹口","虹口")
   group[0][11]=new Option("普陀","普陀")
   group[0][12]=new Option("闸北","闸北")
   group[0][13]=new Option("黄浦","黄浦")
   group[0][14]=new Option("闵行","闵行")
   group[0][15]=new Option("徐汇","徐汇")
   group[0][16]=new Option("嘉定","嘉定")
   group[0][17]=new Option("南汇","南汇")
          //北京
   group[1][0]=new Option("东城","东城")
   group[1][1]=new Option("西城","西城")
   group[1][2]=new Option("崇文","崇文")
   group[1][3]=new Option("宣武","宣武")
   group[1][4]=new Option("朝阳","朝阳")
   group[1][5]=new Option("海淀","海淀")
   group[1][6]=new Option("丰台","丰台")
   group[1][7]=new Option("石景山","石景山")
   group[1][8]=new Option("顺义","顺义")
   group[1][9]=new Option("昌平","昌平")
   group[1][10]=new Option("门头沟","门头沟")
   group[1][11]=new Option("通州","通州")
      group[1][12]=new Option("房山","房山")
   group[1][13]=new Option("大兴","大兴")
   group[1][14]=new Option("延庆","延庆")
   group[1][15]=new Option("怀柔","怀柔")
   group[1][16]=new Option("平谷","平谷")
   group[1][17]=new Option("密云","密云")
        //天津
   group[2][0]=new Option("和平","和平")
   group[2][1]=new Option("河北","河北")
   group[2][2]=new Option("河东","河东")
   group[2][3]=new Option("河西","河西")
   group[2][4]=new Option("南开","南开")
   group[2][5]=new Option("红桥","红桥")
   group[2][6]=new Option("塘沽","塘沽")
   group[2][7]=new Option("汉沽","汉沽")
   group[2][8]=new Option("大港","大港")
   group[2][9]=new Option("东丽","东丽")
   group[2][10]=new Option("西青","西青")
   group[2][11]=new Option("津南","津南")
      group[2][12]=new Option("房山","房山")
   group[2][13]=new Option("北辰","北辰")
   group[2][14]=new Option("武清","武清")
   group[2][15]=new Option("宝坻","宝坻")
   group[2][16]=new Option("蓟县","蓟县")
   group[2][17]=new Option("宁河","宁河")
   group[2][18]=new Option("静海","静海")
   //河北
   group[3][0]=new Option("石家庄","石家庄")
   group[3][1]=new Option("秦皇岛","秦皇岛")
   group[3][2]=new Option("唐山","唐山")
   group[3][3]=new Option("张家口","张家口")
   group[3][4]=new Option("廊坊","廊坊")
   group[3][5]=new Option("衡水","衡水")
   group[3][6]=new Option("保定","保定")
   group[3][7]=new Option("承德","承德")
   group[3][8]=new Option("邢台","邢台")
   group[3][9]=new Option("沧州","沧州")
   group[3][10]=new Option("邯郸","邯郸")
   //内蒙古
   group[4][0]=new Option("呼和浩特","呼和浩特")
   group[4][1]=new Option("包头","包头")
   group[4][2]=new Option("呼伦贝尔","呼伦贝尔")
   group[4][3]=new Option("兴安","兴安")
   group[4][4]=new Option("通辽","通辽")
   group[4][5]=new Option("赤峰","赤峰")
   group[4][6]=new Option("锡林郭勒","锡林郭勒")
   group[4][7]=new Option("乌兰察布","乌兰察布")
   group[4][8]=new Option("鄂尔多斯","鄂尔多斯")
   group[4][9]=new Option("巴彦淖尔","巴彦淖尔")
   group[4][10]=new Option("乌海","乌海")
   group[4][11]=new Option("阿拉善","阿拉善")
   group[4][12]=new Option("满洲里","满洲里")
   group[4][13]=new Option("二连浩特","二连浩特")
     
 //山西
   group[5][0]=new Option("太原","太原")
   group[5][1]=new Option("大同","大同")
   group[5][2]=new Option("阳泉","阳泉")
   group[5][3]=new Option("长治","长治")
   group[5][4]=new Option("晋城","晋城")
   group[5][5]=new Option("朔州","朔州")
   group[5][6]=new Option("忻州","忻州")
   group[5][7]=new Option("晋中","晋中")
   group[5][8]=new Option("临汾","临汾")
   group[5][9]=new Option("吕梁","吕梁")
   group[5][10]=new Option("运城","运城")
   //辽宁
   group[6][0]=new Option("沈阳","沈阳")
   group[6][1]=new Option("大连","大连")
   group[6][2]=new Option("鞍山","鞍山")
   group[6][3]=new Option("锦州","锦州")
   group[6][4]=new Option("丹东","丹东")
   group[6][5]=new Option("锦州","锦州")
   group[6][6]=new Option("丹东","丹东")
   group[6][7]=new Option("盘锦","盘锦")
   group[6][8]=new Option("铁岭","铁岭")
   group[6][9]=new Option("抚顺","抚顺")
   group[6][10]=new Option("营口","营口")
   group[6][11]=new Option("辽阳","辽阳")
   group[6][12]=new Option("阜新","阜新")
   group[6][13]=new Option("本溪","本溪")
   group[6][14]=new Option("朝阳","朝阳")
   group[6][15]=new Option("葫芦岛","葫芦岛")
     
  //吉林
      group[7][1]=new Option("长春","长春")
      group[7][0]=new Option("延边","延边")
   group[7][2]=new Option("吉林","吉林")
   group[7][3]=new Option("四平","四平")
   group[7][4]=new Option("辽源","辽源")
   group[7][5]=new Option("通化","通化")
   group[7][6]=new Option("白山","白山")
   group[7][7]=new Option("松原","松原")
   group[7][8]=new Option("白城","白城")
   
   
   
   
 //黑龙江
         group[8][1]=new Option("大兴安岭","大兴安岭")
   group[8][0]=new Option("哈尔滨","哈尔滨")
   group[8][2]=new Option("齐齐哈尔","齐齐哈尔")
   group[8][3]=new Option("鸡西","鸡西")
   group[8][4]=new Option("鹤岗","鹤岗")
   group[8][5]=new Option("双鸭山","双鸭山")
   group[8][6]=new Option("大庆","大庆")
   group[8][7]=new Option("伊春","伊春")
   group[8][8]=new Option("佳木斯","佳木斯")
   group[8][9]=new Option("七台河","七台河")
   group[8][10]=new Option("牡丹江","牡丹江")
   group[8][11]=new Option("黑河","黑河")
   group[8][12]=new Option("绥化","绥化")
   
   
 //江苏
         group[9][1]=new Option("宿迁","宿迁")
   group[9][0]=new Option("南京","南京")
   group[9][2]=new Option("苏州","苏州")
   group[9][3]=new Option("无锡","无锡")
   group[9][4]=new Option("镇江","镇江")
   group[9][5]=new Option("扬州","扬州")
   group[9][6]=new Option("南通","南通")
   group[9][7]=new Option("常州","常州")
   group[9][8]=new Option("徐州","徐州")
   group[9][9]=new Option("连云港","连云港")
   group[9][10]=new Option("盐城","盐城")
   group[9][11]=new Option("淮安","淮安")
   group[9][12]=new Option("泰州","泰州")
  
   
   
   //山东
            group[10][1]=new Option("临沂","临沂")
   group[10][0]=new Option("济南","济南")
   group[10][2]=new Option("青岛","青岛")
   
            group[10][3]=new Option("烟台","烟台")
   group[10][4]=new Option("淄博","淄博")
   group[10][5]=new Option("泰安","泰安")
   group[10][6]=new Option("潍坊","潍坊")
   group[10][7]=new Option("济宁","济宁")
   group[10][8]=new Option("枣庄","枣庄")
   group[10][9]=new Option("德州","德州")
   group[10][10]=new Option("德州","德州")
   
   group[10][11]=new Option("日照","日照")
   group[10][12]=new Option("莱芜","莱芜")
   group[10][13]=new Option("滨州","滨州")
   
   group[10][14]=new Option("东营","东营")
   group[10][15]=new Option("聊城","聊城")
   
   group[10][16]=new Option("菏泽","菏泽")
   
   
   
   
   //安徽
   group[11][1]=new Option("毫州","毫州")
      group[11][0]=new Option("合肥","合肥")
   group[11][2]=new Option("芜湖","芜湖")
   group[11][3]=new Option("蚌埠","蚌埠")
   group[11][4]=new Option("马鞍山","马鞍山")
   group[11][5]=new Option("淮北","淮北")
   group[11][6]=new Option("铜陵","铜陵")
   group[11][7]=new Option("安庆","安庆")
   group[11][8]=new Option("黄山","黄山")
   group[11][9]=new Option("滁州","滁州")
   group[11][10]=new Option("宿州","宿州")
   group[11][11]=new Option("池州","池州")
   group[11][12]=new Option("淮南","淮南")
   group[11][13]=new Option("巢湖","巢湖")
   group[11][14]=new Option("阜阳","阜阳")
   group[11][15]=new Option("六安","六安")
   group[11][16]=new Option("宣城","宣城")
   

   //福建
   group[12][1]=new Option("宁德","宁德")
   group[12][0]=new Option("福州","福州")
   group[12][2]=new Option("厦门","厦门")
   group[12][3]=new Option("漳州","漳州")
   group[12][4]=new Option("泉州","泉州")
   group[12][5]=new Option("莆田","莆田")
   group[12][6]=new Option("三明","三明")
   group[12][7]=new Option("南平","南平")
   group[12][8]=new Option("龙岩","龙岩")
   
      //浙江 
      group[13][1]=new Option("丽水","丽水")  
   group[13][0]=new Option("杭州","杭州")
   group[13][2]=new Option("宁波","宁波")
   group[13][3]=new Option("温州","温州")
   group[13][4]=new Option("嘉兴","嘉兴")
   group[13][5]=new Option("湖州","湖州")
   group[13][6]=new Option("绍兴","绍兴")
   group[13][7]=new Option("金华","金华")
   group[13][8]=new Option("衢州","衢州")
   group[13][9]=new Option("舟山","舟山")
   group[13][10]=new Option("台州","台州")
   
         //江西
         group[14][1]=new Option("上饶","上饶")
      group[14][0]=new Option("南昌","南昌")
      group[14][2]=new Option("景德镇","景德镇")
   group[14][3]=new Option("萍乡","萍乡")
   group[14][4]=new Option("九江","九江")
   group[14][5]=new Option("新余","新余")
   group[14][6]=new Option("鹰潭","鹰潭")
   group[14][7]=new Option("赣州","赣州")
   group[14][8]=new Option("吉安","吉安")
   group[14][9]=new Option("宜春","宜春")
   group[14][10]=new Option("抚州","抚州")
   
      //广东
      group[15][1]=new Option("云浮","云浮")
   group[15][0]=new Option("广州","广州")
   group[15][2]=new Option("深圳","深圳")
   group[15][3]=new Option("珠海","珠海")
   group[15][4]=new Option("汕头","汕头")
   group[15][5]=new Option("韶关","韶关")
   group[15][6]=new Option("河源","河源")
   group[15][7]=new Option("河源","河源")
   group[15][8]=new Option("惠州","惠州")
   group[15][9]=new Option("汕尾","汕尾")
   group[15][10]=new Option("东莞","东莞")
   group[15][11]=new Option("中山","中山")
   group[15][12]=new Option("江门","江门")
   group[15][13]=new Option("佛山","佛山")
   group[15][14]=new Option("阳江","阳江")
   group[15][15]=new Option("湛江","湛江")
   group[15][16]=new Option("茂名","茂名")
   group[15][17]=new Option("肇庆","肇庆")
   group[15][18]=new Option("清远","清远")
   group[15][19]=new Option("潮州","潮州")
   group[15][20]=new Option("揭阳","揭阳")
   
         //广西
         group[16][1]=new Option("崇左","崇左")
         group[16][0]=new Option("南宁","南宁")
   group[16][2]=new Option("柳州","柳州")
   group[16][3]=new Option("桂林","桂林")
   group[16][4]=new Option("梧州","梧州")
   group[16][5]=new Option("北海","北海")
   group[16][6]=new Option("防城港","防城港")
   group[16][7]=new Option("钦州","钦州")
   group[16][8]=new Option("贵港","贵港")
   group[16][9]=new Option("玉林","玉林")
   group[16][10]=new Option("百色","百色")
   group[16][11]=new Option("贺州","贺州")
   group[16][12]=new Option("河池","河池")
   group[16][13]=new Option("来宾","来宾")
   
   //海南
   group[17][1]=new Option("洋浦","洋浦")
   group[17][0]=new Option("海口","海口")
   group[17][2]=new Option("三亚","三亚")
   group[17][3]=new Option("琼海","琼海")
   group[17][4]=new Option("儋州","儋州")
   group[17][5]=new Option("文昌","文昌")
   group[17][6]=new Option("东方","东方")
   group[17][7]=new Option("五指山","五指山")
   group[17][8]=new Option("万宁","万宁")
   group[17][9]=new Option("定安","定安")
   group[17][10]=new Option("屯昌","屯昌")
   group[17][11]=new Option("澄迈","澄迈")
   group[17][12]=new Option("临高","临高")
   group[17][13]=new Option("陵水","陵水")
   group[17][14]=new Option("琼中","琼中")
   group[17][15]=new Option("保亭","保亭")
   group[17][16]=new Option("乐东","乐东")
   group[17][17]=new Option("昌江","昌江")
   group[17][18]=new Option("白沙","白沙")
   
   //重庆
   group[18][1]=new Option("彭水","彭水")
   group[18][0]=new Option("万州","万州")
   group[18][2]=new Option("涪陵","涪陵")
   group[18][3]=new Option("渝中","渝中")
   group[18][4]=new Option("大渡口","大渡口")
   group[18][5]=new Option("江北","江北")
   group[18][6]=new Option("沙坪坝","沙坪坝")
   group[18][7]=new Option("九龙坡","九龙坡")
   group[18][8]=new Option("南岸","南岸")
   group[18][9]=new Option("北碚","北碚")
   group[18][10]=new Option("万盛","万盛")
   group[18][11]=new Option("双桥","双桥")
   group[18][12]=new Option("渝北","渝北")
   group[18][13]=new Option("巴南","巴南")
   group[18][14]=new Option("黔江","黔江")
   group[18][15]=new Option("长寿","长寿")
   group[18][16]=new Option("江津","江津")
   group[18][17]=new Option("合川","合川")
   group[18][18]=new Option("永川","永川")
   group[18][19]=new Option("南川","南川")
   group[18][20]=new Option("綦江","綦江")
   group[18][21]=new Option("潼南","潼南")
   group[18][22]=new Option("铜梁","铜梁")
   group[18][23]=new Option("大足","大足")
   group[18][24]=new Option("荣昌","荣昌")
   group[18][25]=new Option("壁山","壁山")
   group[18][26]=new Option("梁平","梁平")
   group[18][27]=new Option("城口","城口")
   group[18][28]=new Option("丰都","丰都")
   group[18][29]=new Option("垫江","垫江")
   group[18][30]=new Option("武隆","武隆")
   group[18][31]=new Option("忠县","忠县")
   group[18][32]=new Option("开县","开县")
   group[18][33]=new Option("云阳","云阳")
   group[18][34]=new Option("奉节","奉节")
   group[18][35]=new Option("奉节","奉节")
   group[18][36]=new Option("巫溪","巫溪")
   group[18][37]=new Option("石柱","石柱")
   group[18][38]=new Option("秀山","秀山")
   group[18][39]=new Option("酉阳","酉阳")
  
   //四川
   group[19][1]=new Option("凉山","凉山")
   group[19][0]=new Option("成都","成都")
   group[19][2]=new Option("德阳","德阳")
   group[19][3]=new Option("绵阳","绵阳")
   group[19][4]=new Option("眉山","眉山")
   group[19][5]=new Option("泸州","泸州")
   group[19][6]=new Option("南充","南充")
   group[19][7]=new Option("自贡","自贡")
   group[19][8]=new Option("内江","内江")
   group[19][9]=new Option("宜宾","宜宾")
   group[19][10]=new Option("乐山","乐山")
   group[19][11]=new Option("雅安","雅安")
   group[19][12]=new Option("遂宁","遂宁")
   group[19][13]=new Option("达州","达州")
   group[19][14]=new Option("巴中","巴中")
   group[19][15]=new Option("广元","广元")
   group[19][16]=new Option("广安","广安")
   group[19][17]=new Option("资阳","资阳")
   group[19][18]=new Option("阿坝","阿坝")
   group[19][19]=new Option("攀枝花","攀枝花")
   group[19][20]=new Option("甘孜","甘孜")
   
   //云南
   group[20][1]=new Option("临沧","临沧")
   group[20][0]=new Option("昆明","昆明")
   group[20][2]=new Option("曲靖","曲靖")
   group[20][3]=new Option("玉溪","玉溪")
   group[20][4]=new Option("昭通","昭通")
   group[20][5]=new Option("楚雄","楚雄")
   group[20][6]=new Option("红河","红河")
   group[20][7]=new Option("丽江","丽江")
   group[20][8]=new Option("迪庆","迪庆")
   group[20][9]=new Option("文山","文山")
   group[20][10]=new Option("西双版纳","西双版纳")
   group[20][11]=new Option("思茅","思茅")
   group[20][12]=new Option("大理","大理")
   group[20][13]=new Option("保山","保山")
   group[20][14]=new Option("德宏","德宏")
   group[20][15]=new Option("怒江","怒江")
   
   //贵州
   group[21][1]=new Option("黔东南","黔东南")
   group[21][0]=new Option("贵阳","贵阳")
   group[21][2]=new Option("遵义","遵义")
   group[21][3]=new Option("六盘水","六盘水")
   group[21][4]=new Option("安顺","安顺")
   group[21][5]=new Option("黔西南","黔西南")
   group[21][6]=new Option("黔南","黔南")
   group[21][7]=new Option("铜仁","铜仁")
   group[21][8]=new Option("毕节","毕节")
   
   //西藏
   group[22][0]=new Option("拉萨","拉萨")
   
   //河南
   group[23][1]=new Option("济源","济源")
   group[23][0]=new Option("郑州","郑州")
   group[23][2]=new Option("洛阳","洛阳")
   group[23][3]=new Option("开封","开封")
   group[23][4]=new Option("安阳","安阳")
   group[23][5]=new Option("新乡","新乡")
   group[23][6]=new Option("濮阳","濮阳")
   group[23][7]=new Option("焦作","焦作")
   group[23][8]=new Option("鹤壁","鹤壁")
   group[23][9]=new Option("三门峡","三门峡")
   group[23][10]=new Option("商丘","商丘")
   group[23][11]=new Option("许昌","许昌")
   group[23][12]=new Option("漯河","漯河")
   group[23][13]=new Option("平顶山","平顶山")
   group[23][14]=new Option("驻马店","驻马店")
   group[23][15]=new Option("周口","周口")
   group[23][16]=new Option("南阳","南阳")
   group[23][17]=new Option("信阳","信阳")
   
   //湖北
   group[24][1]=new Option("神农架","神农架")
   group[24][0]=new Option("武汉","武汉")
   group[24][2]=new Option("黄石","黄石")
   group[24][3]=new Option("襄樊","襄樊")
   group[24][4]=new Option("十堰","十堰")
   group[24][5]=new Option("荆州","荆州")
   group[24][6]=new Option("宜昌","宜昌")
   group[24][7]=new Option("荆门","荆门")
   group[24][8]=new Option("鄂州","鄂州")
   group[24][9]=new Option("孝感","孝感")
   group[24][10]=new Option("黄冈","黄冈")
   group[24][11]=new Option("咸宁","咸宁")
   group[24][12]=new Option("随州","随州")
   group[24][13]=new Option("恩施","恩施")
   group[24][14]=new Option("潜江","潜江")
   group[24][15]=new Option("仙桃","仙桃")
   group[24][16]=new Option("天门","天门")
   
   //湖南
   group[25][1]=new Option("醴陵","醴陵")
   group[25][0]=new Option("长沙","长沙")
   group[25][2]=new Option("株州","株州")
   group[25][3]=new Option("湘潭","湘潭")
   group[25][4]=new Option("衡阳","衡阳")
   group[25][5]=new Option("益阳","益阳")
   group[25][6]=new Option("常德","常德")
   group[25][7]=new Option("岳阳","岳阳")
   group[25][8]=new Option("邵阳","邵阳")
   group[25][9]=new Option("郴州","郴州")
   group[25][10]=new Option("娄底","娄底")
   group[25][11]=new Option("永州","永州")
   group[25][12]=new Option("怀化","怀化")
   group[25][13]=new Option("张家界","张家界")
   group[25][14]=new Option("湘西","湘西")
   
   //陕西
   group[26][1]=new Option("杨凌","杨凌")
   group[26][0]=new Option("西安","西安")
   group[26][2]=new Option("宝鸡","宝鸡")
   group[26][3]=new Option("咸阳","咸阳")
   group[26][4]=new Option("渭南","渭南")
   group[26][5]=new Option("延安","延安")
   group[26][6]=new Option("榆林","榆林")
   group[26][7]=new Option("铜川","铜川")
   group[26][8]=new Option("铜川","铜川")
   group[26][9]=new Option("安康","安康")
   group[26][10]=new Option("安康","安康")
   
      //青海
   group[27][0]=new Option("西宁","西宁")
   
   //宁夏
      group[28][0]=new Option("宁夏","宁夏")
    
   //新疆
   group[29][1]=new Option("图木舒克","图木舒克")
   group[29][0]=new Option("乌鲁木齐","乌鲁木齐")
   group[29][2]=new Option("伊犁","伊犁")
   group[29][3]=new Option("阿勒泰","阿勒泰")
   group[29][4]=new Option("塔城","塔城")
   group[29][5]=new Option("博尔塔拉","博尔塔拉")
   group[29][6]=new Option("昌吉","昌吉")
   group[29][7]=new Option("吐鲁番","吐鲁番")
   group[29][8]=new Option("巴音郭楞","巴音郭楞")
   group[29][9]=new Option("哈密","哈密")
   group[29][10]=new Option("和田","和田")
   group[29][11]=new Option("阿克苏","阿克苏")
   group[29][12]=new Option("克孜勒苏","克孜勒苏")
   group[29][13]=new Option("喀什","喀什")
   group[29][14]=new Option("克拉玛依","克拉玛依")
   group[29][15]=new Option("石河子","石河子")
   group[29][16]=new Option("五家渠","五家渠")
   group[29][17]=new Option("阿拉尔阿拉尔","阿拉尔阿拉尔")
   
   //甘肃
   group[30][1]=new Option("甘南","甘南")
   group[30][0]=new Option("兰州","兰州")
   group[30][2]=new Option("天水","天水")
   group[30][3]=new Option("嘉峪关","嘉峪关")
   group[30][4]=new Option("武威","武威")
   group[30][5]=new Option("武威","武威")
   group[30][6]=new Option("酒泉","酒泉")
   group[30][7]=new Option("张掖","张掖")
   group[30][8]=new Option("庆阳","庆阳")
   group[30][9]=new Option("平凉","平凉")
   group[30][10]=new Option("白银","白银")
   group[30][11]=new Option("定西","定西")
   group[30][12]=new Option("陇南","陇南")
   group[30][13]=new Option("临夏","临夏")
   
   //香港
   group[31][0]=new Option("香港","香港")
   //澳门
   group[32][0]=new Option("澳门","澳门")
   //台湾
   group[33][0]=new Option("台湾","台湾")
   
   
   
   var temp=objform.city;
   //alert("temp:"+temp);
   
   for (m=temp.options.length-1;m>0;m--)
   temp.options[m]=null
   for (i=0;i   temp.options[i]=new Option(group[x][i].text,group[x][i].value)
   }
   temp.options[0].selected=true

你可能感兴趣的:(redirect,金山,function,null)