JavaScript and provincial two-level association menu program

Source: Internet
Author: User




var citys=new Array (


New Array ("101010100", "Beijing"),


New Array ("101030100", "Tianjin"),


New Array ("101020100", "Shanghai"),


New Array ("101040100", "Chongqing"),


New Array ("101320101", "Hong Kong"),


New Array ("101330101", "Macau"),


New Array ("101220101", "Hefei"),


New Array ("101220201", "Bengbu"),


New Array ("101220301", "Wuhu"),


New Array ("101220401", "Huainan"),


New Array ("101220501", "Ma On Shan"),


New Array ("101220601", "Anqing"),


New Array ("101220701", "Suzhou"),


New Array ("101220801", "Fuyang"),


New Array ("101220901", "Bozhou"),


New Array ("101221001", "Huangshan"),


New Array ("101221101", "Chuzhou"),


New Array ("101221201", "Huaibei"),


New Array ("101221301", "Tongling"),


New Array ("101221401", "Xuancheng"),


New Array ("101221501", "Liu'an"),


New Array ("101221601", "Chaohu"),


New Array ("101221701", "Chizhou"),


New Array ("101230101", "Fuzhou"),


New Array ("101230201", "Xiamen"),


New Array ("101230301", "Ningde"),


New Array ("101230401", "Putian"),


New Array ("101230501", "Quanzhou"),


New Array ("101230601", "Zhangzhou"),


New Array ("101230701", "Longyan"),


New Array ("101230801", "sanming"),


New Array ("101230901", "Nanping"),


New Array ("101160101", "Lanzhou"),


New Array ("101160201", "Dingxi"),


New Array ("101160301", "Pingliang"),


New Array ("101160401", "Qingyang"),


New Array ("101160501", "Wuwei"),


New Array ("101160601", "Jinchang"),


New Array ("101160701", "Zhangye"),


New Array ("101160801", "Jiuquan"),


New Array ("101160901", "Tianshui"),


New Array ("101161001", "Wudu"),


New Array ("101161101", "Linxia"),


New Array ("101161201", "cooperative"),


New Array ("101161301", "Silver"),


New Array ("101280101", "Guangzhou"),


New Array ("101280201", "Shaoguan"),


New Array ("101280301", "Huizhou"),


New Array ("101280401", "Meizhou"),


New Array ("101280501", "Shantou"),


New Array ("101280601", "Shenzhen"),


New Array ("101280701", "Zhuhai"),


New Array ("101280800", "Foshan"),


New Array ("101280901", "zhaoqing"),


New Array ("101281001", "Zhanjiang"),


New Array ("101281101", "Jiangmen"),


New Array ("101281201", "Heyuan"),


New Array ("101281301", "Qingyuan"),


New Array ("101281401", "Yunfu"),


New Array ("101281501", "Chaozhou"),


New Array ("101281601", "Dongguan"),


New Array ("101281701", "Zhongshan"),


New Array ("101281801", "Yangjiang"),


New Array ("101281901", "Jieyang"),


New Array ("101282001", "Maoming"),


New Array ("101282101", "Shanwei"),


New Array ("101282105", "East Sandy Island"),


New Array ("101300101", "Nanning"),


New Array ("101300201", "Chongzuo"),


New Array ("101300301", "Liuzhou"),


New Array ("101300401", "Guest"),


New Array ("101300501", "Guilin"),


New Array ("101300601", "Wuzhou"),


New Array ("101300701", "Hezhou"),


New Array ("101300801", "Guigang"),


New Array ("101300901", "Yulin"),


New Array ("101301001", "Baise"),


New Array ("101301101", "Qinzhou"),


New Array ("101301201", "Hechi"),


New Array ("101301301", "Beihai"),


New Array ("101301401", "Fangchenggang"),


New Array ("101260101", "Guiyang"),


New Array ("101260201", "Zunyi"),


New Array ("101260301", "Anshun"),


New Array ("101260401", "Duyun"),


New Array ("101260501", "Carey"),


New Array ("101260601", "Tongren"),


New Array ("101260701", "Bijie"),


New Array ("101260801", "Liupanshui"),


New Array ("101260901", "Qianxi"),


New Array ("101310101", "Haikou"),


New Array ("101310102", "Qiongshan"),


New Array ("101310201", "Sanya"),


New Array ("101310202", "Orient"),


New Array ("101310203", "Lingao"),


New Array ("101310204", "Chengmai"),


New Array ("101310205", "Zhanzhou"),


New Array ("101310206", "Changjiang"),


New Array ("101310207", "White Sands"),


New Array ("101310208", "Qiongzhong"),


New Array ("101310209", "Dingan"),


New Array ("101310210", "Tunchang"),


New Array ("101310211", "Qionghai"),


New Array ("101310212", "Wenchang"),


New Array ("101310213", "clear blue"),


New Array ("101310214", "Baoting"),


New Array ("101310215", "Wanning"),


New Array ("101310216", "Lingshui"),


New Array ("101310217", "Xisha"),


New Array ("101310218", "Coral Island"),


New Array ("101310219", "Yong"),


New Array ("101310220", "Nansha Island"),


New Array ("101310221", "Ledong"),


New Array ("101310222", "Pass"),


New Array ("101090101", "Shijiazhuang"),


New Array ("101090201", "Baoding"),


New Array ("101090301", "Zhangjiakou"),


New Array ("101090402", "Chengde"),


New Array ("101090501", "Tangshan"),


New Array ("101090601", "Langfang"),


New Array ("101090701", "Cangzhou"),


New Array ("101090801", "Hengshui"),


New Array ("101090901", "Xingtai"),


New Array ("101091001", "Handan"),


New Array ("101091101", "Qinhuangdao"),


New Array ("101180101", "Zhengzhou"),


New Array ("101180201", "Anyang"),


New Array ("101180301", "Xinxiang"),


New Array ("101180401", "Xuchang"),


New Array ("101180501", "Mesa"),


New Array ("101180601", "Xinyang"),


New Array ("101180701", "Nanyang"),


New Array ("101180801", "Kaifeng"),


New Array ("101180901", "Luoyang"),


New Array ("101181001", "Shangqiu"),


New Array ("101181101", "Jiaozuo"),


New Array ("101181201", "Hebi"),


New Array ("101181301", "Puyang"),


New Array ("101181401", "Zhoukou"),


New Array ("101181501", "Luohe"),


New Array ("101181601", "Zhumadian"),


New Array ("101181701", "Sanmenxia"),


New Array ("101181801", "Jiyuan"),


New Array ("101050101", "Harbin"),


New Array ("101050201", "Qiqihar"),


New Array ("101050301", "Mudanjiang"),


New Array ("101050401", "Jiamusi"),


New Array ("101050501", "Suihua"),


New Array ("101050601", "Heihe"),


New Array ("101050701", "daxinganling"),


New Array ("101050801", "Yichun"),


New Array ("101050901", "Daqing"),


New Array ("101051002", "Qitaihe"),


New Array ("101051101", "Jixi"),


New Array ("101051201", "Hegang"),


New Array ("101051301", "Shuangyashan"),


New Array ("101200101", "Wuhan"),


New Array ("101200201", "Xiangfan"),


New Array ("101200301", "Ezhou"),


New Array ("101200401", "Xiaogan"),


New Array ("101200501", "Huanggang"),


New Array ("101200601", "Yellowstone"),


New Array ("101200701", "xianning"),


New Array ("101200801", "Jingzhou"),


New Array ("101200901", "Yichang"),


New Array ("101201001", "Enshi"),


New Array ("101201101", "Shiyan"),


New Array ("101201201", "Shennongjia"),


New Array ("101201301", "Suizhou"),


New Array ("101201401", "Jingmen"),


New Array ("101201501", "Tianmen"),


New Array ("101201601", "Peach"),


New Array ("101201701", "Qianjiang"),


New Array ("101250101", "Changsha"),


New Array ("101250201", "Xiangtan"),


New Array ("101250301", "Zhuzhou"),


New Array ("101250401", "Hengyang"),


New Array ("101250501", "Chenzhou"),


New Array ("101250601", "Changde"),


New Array ("101250701", "Yiyang"),


New Array ("101250801", "Loudi"),


New Array ("101250901", "Shaoyang"),


New Array ("101251001", "Yueyang"),


New Array ("101251101", "Zhangjiajie"),


New Array ("101251201", "Huaihua"),


New Array ("101251301", "Guizhou Yang"),


New Array ("101251401", "Yongzhou"),


New Array ("101251501", "Jishou"),


New Array ("101060101", "Changchun"),


New Array ("101060201", "Jilin"),


New Array ("101060301", "Yanji"),


New Array ("101060401", "Siping"),


New Array ("101060501", "Tonghua"),


New Array ("101060601", "Baicheng"),


New Array ("101060701", "Liaoyuan"),


New Array ("101060801", "Songyuan"),


New Array ("101060901", "Bss"),


New Array ("101190101", "Nanjing"),


New Array ("101190201", "Wuxi"),


New Array ("101190301", "Zhenjiang"),


New Array ("101190401", "Suzhou"),


New Array ("101190501", "Nantong"),


New Array ("101190601", "Yangzhou"),


New Array ("101190701", "Yancheng"),


New Array ("101190801", "Xuzhou"),


New Array ("101190901", "Huaian"),


New Array ("101191001", "Lianyungang"),


New Array ("101191101", "Changzhou"),


New Array ("101191201", "Taizhou"),


New Array ("101191301", "Suqian"),


New Array ("101240101", "Nanchang"),


New Array ("101240201", "Jiujiang"),


New Array ("101240301", "Shangrao"),


New Array ("101240401", "Fuzhou"),


New Array ("101240501", "Yichun"),


New Array ("101240601", "Ji"),


New Array ("101240701", "Ganzhou"),


New Array ("101240801", "Jingdezhen"),


New Array ("101240901", "Pingxiang"),


New Array ("101241001", "Xinyu"),


New Array ("101241101", "Yingtan"),


New Array ("101070101", "Shenyang"),


New Array ("101070201", "Dalian"),


New Array ("101070301", "Anshan"),


New Array ("101070401", "Fushun"),


New Array ("101070501", "Benxi"),


New Array ("101070601", "Danton"),


New Array ("101070701", "Jinzhou"),


New Array ("101070801", "Yingkou"),


New Array ("101070901", "Fuxin"),


New Array ("101071001", "Liaoyang"),


New Array ("101071101", "Tieling"),


New Array ("101071201", "Sunrise"),


New Array ("101071301", "Panjin"),


New Array ("101071401", "Huludao"),


New Array ("101080101", "Hohhot"),


New Array ("101080201", "Baotou"),


New Array ("101080301", "Wuhai"),


New Array ("101080401", "Jining"),


New Array ("101080501", "Tongliao"),


New Array ("101080601", "Chifeng"),


New Array ("101080701", "Erdos"),


New Array ("101080801", "Linhe"),


New Array ("101080901", "Xilin Hot"),


New Array ("101081000", "Hulunbeier"),


New Array ("101081101", "Ulanhot"),


New Array ("101081201", "Alxa Zuoqi"),


New Array ("101170101", "Yinchuan"),


New Array ("101170201", "Shizuishan"),


New Array ("101170301", "Wuzhong"),


New Array ("101170401", "Guyuan"),


New Array ("101170501", "central defender"),


New Array ("101150101", "Xining"),


New Array ("101150201", "Haidong"),


New Array ("101150301", "Huangnan"),


New Array ("101150401", "Hainan"),


New Array ("101150501", "Fruit Luo"),


New Array ("101150601", "Yushu"),


New Array ("101150701", "Hercynian"),


New Array ("101150801", "Sea North"),


New Array ("101120101", "Jinan"),


New Array ("101120201", "Qingdao"),


New Array ("101120301", "Zibo"),


New Array ("101120401", "Texas"),


New Array ("101120501", "Yantai"),


New Array ("101120601", "Weifang"),


New Array ("101120701", "Jining"),


New Array ("101120801", "Taian"),


New Array ("101120901", "Linyi"),


New Array ("101121001", "Heze"),


New Array ("101121101", "Binzhou"),


New Array ("101121201", "dongying"),


New Array ("101121301", "Weihai"),


New Array ("101121401", "Zaozhuang"),


New Array ("101121501", "Sunshine"),


New Array ("101121601", "Laiwu"),


New Array ("101121701", "Liaocheng"),


New Array ("101100101", "Taiyuan"),


New Array ("101100201", "Datong"),


New Array ("101100301", "Yangquan"),


New Array ("101100401", "Jinzhong"),


New Array ("101100501", "Changzhi"),


New Array ("101100601", "Jincheng"),


New Array ("101100701", "Linfen"),


New Array ("101100801", "Yuncheng"),


New Array ("101100901", "Shuozhou"),


New Array ("101101001", "Xinzhou"),


New Array ("101101100", "Luliang"),


New Array ("101110101", "Xian"),


New Array ("101110200", "Xianyang"),


New Array ("101110300", "Yanan"),


New Array ("101110401", "Yulin"),


New Array ("101110501", "Weinan"),


New Array ("101110601", "Shangluo"),


New Array ("101110701", "Ankang"),


New Array ("101110801", "Hanzhong"),


New Array ("101110901", "Baoji"),


New Array ("101111001", "Tongchuan"),


New Array ("101270101", "Chengdu"),


New Array ("101270201", "Panzhihua"),


New Array ("101270301", "Zigong"),


New Array ("101270401", "Mianyang"),


New Array ("101270501", "Nanchong"),


New Array ("101270601", "Dazhou"),


New Array ("101270701", "Suining"),


New Array ("101270801", "Guang"),


New Array ("101270901", "Bazhong"),


New Array ("101271001", "Luzhou"),


New Array ("101271101", "Yibin"),


New Array ("101271201", "Neijiang"),


New Array ("101271301", "Ziyang"),


New Array ("101271401", "Leshan"),


New Array ("101271501", "Meishan"),


New Array ("101271601", "Liangshan"),


New Array ("101271701", "Yaan"),


New Array ("101271801", "Ganzi"),


New Array ("101271901", "Aba"),


New Array ("101272001", "Deyang"),


New Array ("101272101", "Guangyuan"),


New Array ("101340101", "Taipei County"),


New Array ("101340201", "Kaohsiung"),


New Array ("101340301", "Tainan"),


New Array ("101340401", "Taichung"),


New Array ("101340501", "Taoyuan"),


New Array ("101340601", "Xinzhu County"),


New Array ("101340701", "Yilan"),


New Array ("101340801", "Magong"),


New Array ("101340901", "Chiayi"),


New Array ("101341001", "Hualian"),


New Array ("101341101", "Taitung"),


New Array ("101341201", "Peng Jia yu"),


New Array ("101140101", "Lhasa"),


New Array ("101140201", "Shigatse"),


New Array ("101140301", "Shannan"),


New Array ("101140401", "Linzhi"),


New Array ("101140501", "Qamdo"),


New Array ("101140601", "NA"),


New Array ("101140701", "Ali"),


New Array ("101130101", "Urumqi"),


New Array ("101130201", "Karamay"),


New Array ("101130301", "Shihezi"),


New Array ("101130401", "Changji"),


New Array ("101130501", "Turpan"),


New Array ("101130601", "Korla"),


New Array ("101130701", "Alar"),


New Array ("101130801", "Aksu"),


New Array ("101130901", "Kashi"),


New Array ("101131001", "Yining"),


New Array ("101131101", "Tacheng"),


New Array ("101131201", "Hami"),


New Array ("101131301", "Hotan"),


New Array ("101131401", "Altay"),


New Array ("101131501", "Atushi"),


New Array ("1011301601", "Bole"),


New Array ("101290101", "Kunming"),


New Array ("101290201", "Dali"),


New Array ("101290301", "Red River"),


New Array ("101290401", "Qujing"),


New Array ("101290501", "Baoshan"),


New Array ("101290601", "Wenshan"),


New Array ("101290701", "Yuxi"),


New Array ("101290801", "Chuxiong"),


New Array ("101290901", "Simao"),


New Array ("101291001", "Zhaotong"),


New Array ("101291101", "Lincang"),


New Array ("101291201", "Nujiang"),


New Array ("101291301", "Zhongdian"),


New Array ("101291401", "Lijiang"),


New Array ("101291501", "de macro"),


New Array ("101291601", "Jinghong"),


New Array ("101210101", "Hangzhou"),


New Array ("101210201", "Huzhou"),


New Array ("101210301", "Jiaxing"),


New Array ("101210401", "Ningbo"),


New Array ("101210501", "Shaoxing"),


New Array ("101210601", "Taizhou"),


New Array ("101210701", "Wenzhou"),


New Array ("101210801", "Lishui"),


New Array ("101210901", "Jinhua"),


New Array ("101211001", "Quzhou"),


New Array ("101211101", "Zhoushan")


);

var queryurl= "HTTP://COUNTER.SINA.COM.CN/IP";


if (Navigator.userAgent.toLowerCase (). IndexOf (' msie ') >= 0) {


document.getElementById ("Ip_forie"). src = queryurl;


} else {


var js = document.createelement ("script");


Js.setattribute ("type", "Text/javascript");


Js.setattribute ("CharSet", "gb2312");


Js.setattribute ("src", queryurl);


Document.body.insertBefore (JS, null);


}


function Ildata_callback ()


{var ip=ildata[0];//ip


var country = ildata[1];//Country


var province = ildata[2];//Province


var city = ildata[3]; Area


var new_city_id = 101010100; Default Beijing weather


var cityname= ' Beijing ';


if (Country!= "" | | Province!= "" | | City!= "")


{


Coun_len = (Country = = "")? 0:country.length;


Prov_len = (province = = "")? 0:province.length;


City_len = (City = = "") 0:city.length;





for (i=0;i<citys.length;i++)


{


Min_coun_len = (coun_len==0)? 0: ((coun_len<citys[i][1].length)? coun_len:citys[i][1].length);


Min_prov_len = (prov_len==0)? 0: ((prov_len<citys[i][1].length)? prov_len:citys[i][1].length);


Min_city_len = (city_len==0)? 0: ((city_len<citys[i][1].length)? city_len:citys[i][1].length);

if ((min_city_len!=0 && city.substr (0,min_city_len) ==citys[i][1].substr (0,min_city_len))


|| (Min_prov_len!=0 && province.substr (0,min_prov_len) ==citys[i][1].substr (0,min_prov_len))


|| (Min_coun_len!=0 && country.substr (0,min_coun_len) ==citys[i][1].substr (0,min_coun_len)))


{


new_city_id = citys[i][0];


CITYNAME=CITYS[I][1];


Break


}


}


}else{


new_city_id=101010100;


Cityname= ' Beijing ';


}





var getid=getquerystring (' id ');





if (getid== ')


{


getid=new_city_id;


}





Startrequest ("www.111cn.net?cityid=" +getid,weatherifno);


}





Window.onerror=function () {


return true;


}

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.