JavaScript City Select Linkage Menu code

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax array class code document function get get down

The following page special effects City Select Linkage Menu code is I get down from other sites, very good use, all cities are used, you just put the JS part of the save, and then fix Select to modify as follows this select the same name can be used.

<p><select class= "select_com" id= "City" style= "Margin-top: -1px; Margin-left: -1px; width:134px; height:25px "name=" City ">


<option selected= "selected" > select City </option>


</select> www.111cn.net</p>


<script>


var eczones = new Array ();


eczones[0]= "Beijing | Beijing";


eczones[1]= "Shanghai | Shanghai";


eczones[2]= "Tianjin | Tianjin";


eczones[3]= "Chongqing | Chongqing";


eczones[4]= "Guangdong | Guangdong";


eczones[5]= "Jiangsu | Jiangsu";


eczones[6]= "Zhejiang | zhejiang";


eczones[7]= "Fujian | Fujian";


eczones[8]= "Hunan | hunan";


eczones[9]= "Hubei | Hubei";


eczones[10]= "Shandong | Shandong";


eczones[11]= "Liaoning | Liaoning";


eczones[12]= "Jilin | Jilin";


eczones[13]= "Yunnan | Yunnan";


eczones[14]= "Sichuan | Sichuan";


eczones[15]= "Anhui | Anhui";


eczones[16]= "Jiangxi | Jiangxi";


eczones[17]= "Heilongjiang | Heilongjiang";


eczones[18]= "Hebei | Hebei";


eczones[19]= "Shaanxi | Shaanxi";


eczones[20]= "Hainan | Hainan";


eczones[21]= "Henan | Henan";


eczones[22]= "Shanxi | Shanxi";


eczones[23]= "Inner Mongolia | Inner Mongolia";


eczones[24]= "Guangxi | Guangxi";


eczones[25]= "Guizhou | Guizhou";


eczones[26]= "Ningxia | Ningxia";


eczones[27]= "Qinghai | Qinghai";


eczones[28]= "Xinjiang | Xinjiang";


eczones[29]= "Tibet | Tibet";


eczones[30]= "Gansu | Gansu";


eczones[31]= "Taiwan | Taiwan";


eczones[32]= "Hong Kong | Hong Kong";


eczones[33]= "Macau | Macau";


eczones[34]= "abroad | abroad";


Eczones[35]= "not limited to |";


  


function Setcity2 (thevalue,instance,selectvalue) {


switch (thevalue) {


case ' Beijing ':


var labels = new Array ("Beijing");


var values = new Array ("Beijing");


break;


case ' Tianjin ':


var labels = new Array ("Tianjin");


var values = new Array ("Tianjin");


Break


case ' Shanghai ':


var labels = new Array ("Shanghai City");


var values = new Array ("Shanghai City");


Break


case ' Chongqing ':


var labels = new Array ("Chongqing city");


var values = new Array ("Chongqing city");


Break


case ' Hunan ':


var labels = new Array ("Changsha", "Xiangtan", "Yueyang," Zhuzhou "," Zhangjiajie "," Hengyang "," Chenzhou "," Xiangxiang "," Miluo "," Changde "," Jinshi "," Jishou "," Loudi "," Lianyuan "," Lengshuijiang "," Huaihua "," Hongjiang ", "Yiyang", "Leiyang", "Shaoyang", "Yongzhou", "Lengshuitan", "other");


var values = new Array ("Changsha", "Xiangtan", "Yueyang", "Zhuzhou," Zhangjiajie "," Hengyang "," Chenzhou "," Xiangxiang "," Miluo "," Changde "," Jinshi "," Jishou "," Loudi "," Lianyuan "," Lengshuijiang "," Huaihua "," Hongjiang "," Yiyang " , "Leiyang", "Shaoyang", "Yongzhou", "Lengshuitan", "other");


Break


case ' Jiangsu ':


var labels = new Array ("Nanjing", "Suzhou", "Wuxi", "Yangzhou", "Changzhou", "Zhenjiang", "Nantong", "Jiangyin", "Lianyungang", "Xuzhou", "Huaiyin", "Suqian", "Dongtai", "Taizhou", "Yizheng", "Danyang", "Yixing", " Changshu "," Huai ' an "," Yancheng "," Xinghua "," Jiangyan "," other ");


var values = new Array ("Nanjing", "Suzhou", "Wuxi", "Yangzhou", "Changzhou", "Zhenjiang", "Nantong", "Jiangyin", "Lianyungang", "Xuzhou", "Huaiyin", "Suqian", "Dongtai", "Taizhou", "Yizheng", "Danyang", "Yixing", " Changshu "," Huai ' an "," Yancheng "," Xinghua "," Jiangyan "," other ");


Break


case ' Zhejiang ':


var labels = new Array ("Hangzhou", "Ningbo", "Wenzhou", "" Jinhua "," Yiwu "," Shaoxing "," Huzhou "," Yuyao "," Linhai "," Xiaoshan "," Lin ' an "," Zhuji "," Shengsi "," Shaoxing County "," Lanxi County "," Jiaxing "," Haining ", "Tongxiang", "Quzhou", "Shangyu", "Shengzhou", "Cixi", "Lishui", "Ouhai", "Huangyan", "Jiaojiang", "Taizhou", "other");


var values = new Array ("Hangzhou", "Ningbo", "Wenzhou", "" Jinhua "," Yiwu "," Shaoxing "," Huzhou "," Yuyao "," Linhai "," Xiaoshan "," Lin ' an "," Zhuji "," Shengsi "," Shaoxing County "," Lanxi County "," Jiaxing "," Haining ", "Tongxiang", "Quzhou", "Shangyu", "Shengzhou", "Cixi", "Lishui", "Ouhai", "Huangyan", "Jiaojiang", "Taizhou", "other");


Break


case ' Fujian ':


var labels = new Array ("Fuzhou", "Xiamen", "Quanzhou", "Zhangzhou", "Shishi", "sanming", "Nanping", "Putian", "Yongan", "Shaowu", "Longyan", "other");


var values = new Array ("Fuzhou", "Xiamen", "Quanzhou", "Zhangzhou", "Shishi", "sanming", "Nanping", "Putian", "Yongan", "Shaowu", "Longyan", "other");


Break


case ' Guangdong ':


var labels = new Array ("Guangzhou", "Shenzhen", "Dongguan", "Zhongshan", "Foshan", "Zhuhai", "Huizhou", "Shantou", "Zhanjiang", "Chaozhou", "Chaoyang", "Jiangmen", "Shanwei", "Maoming", "Yangjiang", "Zhaoqing", "Meizhou", "  Yunfu "," Qingyuan "," Shaoguan "," Heyuan "," Jieyang "," other ");


var values = new Array ("Guangzhou", "Shenzhen", "Dongguan", "Zhongshan", "Foshan", "Zhuhai", "Huizhou", "Shantou", "Zhanjiang", "Chaozhou", "Chaoyang", "Jiangmen", "Shanwei", "Maoming", "Yangjiang", "Zhaoqing", "Meizhou", " Yunfu "," Qingyuan "," Shaoguan "," Heyuan "," Jieyang "," other ");


Break


case ' Hubei ':


var labels = new Array ("Wuhan", "Yichang", "Xiaogan", "Jingzhou", "Xiangfan", "Laohekou", "Zhicheng", "Zaoyang", "Jingmen", "Yicheng", "Yellowstone", "Ezhou", "Huanggang", "Xianning", "Wuxue", "Bushing", "Macheng", " Shiyan, "Enshi", "Danjiangkou", "Lichuan", "Tianmen", "Hanchuan", "Honghu Lake", "Yingcheng", "Qianjiang", "Anlu", "Xiantao", "Suizhou", "Shishou", "other");


var values = new Array ("Wuhan", "Yichang", "Xiaogan", "Jingzhou", "Xiangfan", "Laohekou", "Zhicheng", "Zaoyang", "Jingmen", "Yicheng", "Huangshi", "Ezhou", "Huanggang", "Xianning", "Wuxue", "Bushing", "Macheng", "Shiyan", "Enshi", "Danjiangkou", "Lichuan", "Tianmen", "Hanchuan", "Honghu Lake", "Yingcheng", "Qianjiang", "Anlu", "Xiantao", "Suizhou", "Shishou", "other");


Break


case ' Shandong ':


var labels = new Array ("Jinan", "Qingdao", "Yantai", "Zibo," Weifang "," Linyi "," Laiwu "," Jining "," Heze "," Sunshine "," Rattan state "," Liaocheng "," Dezhou "," Binzhou "," Linqing "," Qingzhou "," Weihai "," Taian, "Xintai", "Qufu", "dongying", "Zhucheng", "Zaozhuang", "other";


var values = new Array ("Jinan", "Qingdao", "Yantai", "Zibo," Weifang "," Linyi "," Laiwu "," Jining "," Heze "," Sunshine "," Rattan state "," Liaocheng "," Dezhou "," Binzhou "," Linqing "," Qingzhou "," Weihai "," Taian, "Xintai", "Qufu", "dongying", "Zhucheng", "Zaozhuang", "other";


Break


case ' Liaoning ':


var labels = new Array ("Shenyang", "Tieling", "Fushun", "Dalian", "Benxi", "Yingkou", "Jinzhou", "Xingcheng", "Beipiao", "Panjin", "Liaoyang", "Tie", "Anshan", "Wafangdian", "Dandong", "Jinxi", "Chaoyang", " Fuxin "," Haicheng "," other ");


var values = new Array ("Shenyang", "Tieling", "Fushun", "Dalian", "Benxi", "Yingkou", "Jinzhou", "Xingcheng", "Beipiao", "Panjin", "Liaoyang", "Tie", "Anshan", "Wafangdian", "Dandong", "Jinxi", "Chaoyang", " Fuxin "," Haicheng "," other ");


Break


case ' Jilin ':


var labels = new Array ("Changchun", "Jilin", "Tonghua", "Fuyu", "Huadian", "Yanji", "Map Gate", "Longjing", "Dunhua", "Ji ' an", "Hunjiang", "Meihekou", "Siping", "gongzhuling", "Liaoyuan", "Baicheng", "Zhaonan", "JIU" , "other");


var values = new Array ("Changchun", "Jilin", "Tonghua", "Fuyu", "Huadian", "Yanji", "Map Gate", "Longjing", "Dunhua", "Ji ' an", "Hunjiang", "Meihekou", "Siping", "gongzhuling", "Liaoyuan", "Baicheng", "Zhaonan", "Jiu", "other");


Break


case ' Yunnan ':


var labels = new Array ("Kunming", "Qujing", "Dali", "Yuxi", "Lijiang", "Chuxiong", "Kaiyuan", "Di Qing", "Dongchuan", "Zhaotong", "Gejiu", "Baoshan", "Wenshan", "other");


var values = new Array ("Kunming", "Qujing", "Dali", "Yuxi", "Lijiang", "Chuxiong", "Kaiyuan", "Di Qing", "Dongchuan", "Zhaotong", "Gejiu", "Baoshan", "Wenshan", "other");


Break


case ' Sichuan ':


var labels = new Array ("Chengdu", "Yibin", "Luzhou", "Neijiang," Panzhihua "," Xichang "," Deyang "," Yaan "," Suining "," Nanchong "," Mianyang "," Guangyuan "," Maerkang "," Da Da "," Hua Jian "," Zigong "," Leshan ", "Other");


var values = new Array ("Chengdu", "Yibin", "Luzhou", "Neijiang," Panzhihua "," Xichang "," Deyang "," Yaan "," Suining "," Nanchong "," Mianyang "," Guangyuan "," Maerkang "," Da Da "," Hua Jian "," Zigong "," Leshan ", "Other");


Break


case ' Anhui ':


var labels = new Array ("Hefei", "Wuhu", "Ma On Shan", "Bengbu", "Tongling", "Huaibei", "Huainan", "Bozhou", "Chaohu", "Huangshan", "Xian", "Suzhou", "Fuyang", "Liu'an", "Chuzhou", "Xuanzhou", "Huangshan", "Anqing", "Other");


var values = new Array ("Hefei", "Wuhu", "Ma On Shan", "Bengbu", "Tongling", "Huaibei", "Huainan", "Bozhou", "Chaohu", "Huangshan", "Xian", "Suzhou", "Fuyang", "Liu'an", "Chuzhou", "Xuanzhou", "Huangshan", " Anqing "," other ");


Break


case ' Jiangxi ':


var labels = new Array ("Nanchang", "Jingdezhen," Jiujiang "," Yingtan "," Yichun "," Xinyu "," Pingxiang "," Ganzhou "," Ji "," Jinggangshan "," Fuzhou "," Linchuan "," Shangrao "," other ");


var values = new Array ("Nanchang", "Jingdezhen," Jiujiang "," Yingtan "," Yichun "," Xinyu "," Pingxiang "," Ganzhou "," Ji "," Jinggangshan "," Fuzhou "," Linchuan "," Shangrao "," other ");


Break


case ' Heilongjiang ':


var labels = new Array ("Harbin", "Jiamusi", "Mudanjiang," Daqing "," Qiqihar "," Cheng "," Zhaodong "," Suihua "," Yichun "," Hegang "," Qitaihe "," Double Duck "," Jiang "," Sui Fen "," Jixi "," Bei ", "Heihe", "Wuda Lian Chi", "other");


var values = new Array ("Harbin", "Jiamusi", "Mudanjiang," Daqing "," Qiqihar "," Cheng "," Zhaodong "," Suihua "," Yichun "," Hegang "," Qitaihe "," Double Duck "," Jiang "," Sui Fen "," Jixi "," Bei ", "Heihe", "Wuda Lian Chi", "other");


Break


case ' Hebei ':


var labels = new Array ("Shijiazhuang", "Handan", "Baoding", "Zhangjiakou", "Qinhuangdao", "Xinji", "Xingtai", "Botou", "Tangshan", "Beidaihe", "Langfang", "Dingzhou", "Nangong", "Hengshui", "Shahe", "Cangzhou", "Renqiu", " Chengde, "Zhuozhou", "other");


var values = new Array ("Shijiazhuang", "Handan", "Baoding," Zhangjiakou "," Qinhuangdao "," Xinji "," Xingtai "," Botou "," Tangshan "," Beidaihe "," Langfang "," Dingzhou "," Nangong "," Hengshui "," Shahe "," Cangzhou "," Renqiu "," Chengde "," Zhuozhou "," other ");


Break


case ' Shaanxi ':


var labels = new Array ("Xi ' an", "Xianyang", "Baoji", "Tongchuan", "Weinan", "Yanan", "Hanzhong", "Hancheng", "other");


var values = new Array ("Xi ' an", "Xianyang", "Baoji", "Tongchuan", "Weinan", "Yanan", "Hanzhong", "Hancheng", "other");


Break


case ' Hainan ':


var labels = new Array ("Haikou", "Sanya", "Qionghai", "Tong", "other");


var values = new Array ("Haikou", "Sanya", "Qionghai", "Tong", "other");


Break


case ' Henan ':


var labels = new Array ("Zhengzhou", "Luoyang", "Kaifeng," Hebi "," Jiaozuo "," Xuchang "," Zhumadian "," Zhoukou "," Xinxiang "," Anyang "," Puyang "," Luohe "," Xinyang "," Pingdingshan "," Sanmenxia "," Nanyang "," Shangqiu " , "Yima", "other");


var values = new Array ("Zhengzhou", "Luoyang", "Kaifeng", "Hebi", "Jiaozuo", "Xuchang", "Zhumadian", "Zhoukou", "Xinxiang", "Anyang", "Puyang", "Luohe", "Xinyang", "Pingdingshan", "Sanmenxia", "Nanyang", "Shangqiu", "Yima "," other ");


Break


case ' Shanxi ':


var labels = new Array ("Taiyuan", "Datong", "Xinzhou", "Linfen", "Yuncheng", "Changzhi", "Yuci", "Houma", "Yangquan", "Jincheng", "other");


var values = new Array ("Taiyuan", "Datong", "Xinzhou", "Linfen", "Yuncheng", "Changzhi", "Yuci", "Houma", "Yangquan", "Jincheng", "other");


Break


case ' Inner Mongolia ':


var labels = new Array ("Hohhot", "Chifeng", "" Baotou "," Erenhot "," Linhe "," Dongsheng "," Manzhouli "," Ulanhot "," Huolinguolei "," Jining "," Wuhai "," Hailar "," Yakeshi "," Xilin Hot "," Tongliao " , "Zalantun", "other");


var values = new Array ("Hohhot", "Chifeng", "" Baotou "," Erenhot "," Linhe "," Dongsheng "," Manzhouli "," Ulanhot "," Huolinguolei "," Jining "," Wuhai "," Hailar "," Yakeshi "," Xilin Hot "," Tongliao " , "Zalantun", "other");


Break


case ' Guangxi ':


var labels = new Array ("Nanning", "Guilin", "Beihai", "Liuzhou", "Yulin", "Baise", "Hechi", "Pingxiang", "Qinzhou", "Wuzhou", "Heshan", "other");


var values = new Array ("Nanning", "Guilin", "Beihai", "Liuzhou", "Yulin", "Baise", "Hechi", "Pingxiang", "Qinzhou", "Wuzhou", "Heshan", "other");


Break


Case ' Guizhou ':


var labels = new Array ("Guiyang", "Zunyi", "Tongren", "Duyun", "Xingyi", "Chishui", "Liupanshui", "Carey", "Anshun", "other");


var values = new Array ("Guiyang", "Zunyi", "Tongren", "Duyun", "Xingyi", "Chishui", "Liupanshui", "Carey", "Anshun", "other");


Break


case ' Ningxia ':


var labels = new Array ("Yinchuan", "Qingtongxia", "Wuzhong", "Shizuishan", "Zhongwei", "zhongning", "Guyuan", "other");


var values = new Array ("Yinchuan", "Qingtongxia", "Wuzhong", "Shizuishan", "Zhongwei", "zhongning", "Guyuan", "other");


Break


case ' Qinghai ':


var labels = new Array ("Xining", "Golmud", "Republic", "Delinha", "other");


var values = new Array ("Xining", "Golmud", "Republic", "Delinha", "other");


Break


case ' Xinjiang ':


var labels = new Array ("Urumqi", "Shihezi," Karamay "," Bole "," Tacheng "," Altay "," Hami "," Aksu "," Atushi "," Changji "," Kuitun "," Yining "," Turpan "," Korla "," Kashgar "," Hotan "," other ");


var values = new Array ("Urumqi", "Shihezi," Karamay "," Bole "," Tacheng "," Altay "," Hami "," Aksu "," Atushi "," Changji "," Kuitun "," Yining "," Turpan "," Korla "," Kashgar "," Hotan "," other ");


Break


case ' Tibet ':


var labels = new Array ("Lhasa", "Shigatse", "other");


var values = new Array ("Lhasa", "Shigatse", "other");


Break


case ' Gansu ':


var labels = new Array ("Lanzhou", "Jiuquan", "Linxia", "Zhangye", "Jiayuguan", "Jinchang", "Pingliang", "Silver", "Wuwei", "Yumen", "Tianshui", "Xifeng", "other");


var values = new Array ("Lanzhou", "Jiuquan", "Linxia", "Zhangye", "Jiayuguan", "Jinchang", "Pingliang", "Silver", "Wuwei", "Yumen", "Tianshui", "Xifeng", "other");


Break


case ' Taiwan ':


var labels = new Array ("Taipei", "Taichung", "Keelung", "Tainan", "other");


var labels = new Array ("Taipei", "Taichung", "Keelung", "Tainan", "other");


Break


case ' Hong Kong ':


var labels = new Array ("Hong Kong");


var values = new Array ("Hong Kong");


Break


case ' Macau ':


var labels = new Array ("Macau");


var values = new Array ("Macau");


Break


case ' foreign ':


var labels = new Array ("foreign");


var values = new Array ("foreign");


Break

}
instance.options.length = 0;
for (var i = 0; i < labels.length; i++) {
Instance.add (document.createelement ("option"));
Instance.options[i].text=labels[i];
Instance.options[i].value=values[i];
if (Instance.options[i].value==selectvalue)
Instance.options[i].selected=true
}
}

Function Initecselector (instance,optionlist,selectvalue)
{
 var i, Aindex, Alength, Avaluetext;
 instance.length=0;
 instance.options[0] = new Option ("Select Province", "0")
 for (i=0;i<optionlist.length;i++)
 {
  avaluetext = optionlist[i].split ("|");
  if (avaluetext.length>0)
   instance.options[instance.length] = new option ( AVALUETEXT[1], avaluetext[0])
   if (avaluetext[0]==selectvalue)
    Instance.options[i].selected=true
 
}
Initecselector (document.getElementById ("area"), Eczones, ' Beijing ');
Function Zhuanyio ()
{
Setcity2 (document.getElementById (' area '). Value,document.getelementbyid ("City"), ')
}
</script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.