贵州
- 安徽
- 北京
- 重庆
- 大连
- 福建(不含厦门)
- 甘肃
- 广东(不含深圳)
- 广西
- 贵州
- 海南
- 河北
- 河南
- 湖北
- 湖南
- 吉林
- 江苏(不含苏州)
- 江西
- 内蒙
- 黑龙江
- 宁波
- 宁夏
- 青岛
- 青海
- 山东(不含青岛)
- 山西
- 陕西
- 上海
- 深圳
- 四川
- 苏州
- 天津
- 厦门
- 新疆
- 云南
- 浙江(不含宁波)
- 空气质量指数:40
- 矮油,当前地区还没有活动哦!
/********************************/ /**** update:2013-6-9 19:10 ****/ //如有改动请修改这里的信息 /**** by: wangyong ****/ /********************************/ define(function(require, exports, module) { //start require("hpcommon"); if(typeof(HPcommon) =="undefined"){ var loading_fail_obj = document.createElement("div"); loading_fail_obj.className = "com-load-fail"; loading_fail_obj.innerHTML = "加载失败,请刷新"; document.body.appendChild(loading_fail_obj); } var hpcom = new HPcommon(); //调用公共函数 //全局变量 var search_obj = hpcom.$("#position"), search_info_obj = hpcom.$("#potion-info"), search_li = hpcom.$(".hotel-search")[0], myposition_nums = 0, address_url = "",address_lat,address_lon,cache = window.localStorage,city_obj,date_obj,cache_keyword="act_show_act_list_index"; cacheCookie=new showCookie(); if(!cache){ cache=window.sessionStorage; } var hoteljs = function(){ }; hoteljs.prototype = { //[公共]返回 button_prev: function(i){ if(!i) i=1; else i=0-i; history.go(i); }, loaded: function(){ //button,li链接跳转 hpcom.goUrl(); //模仿active hpcom.onActive(); //select赋值 //hpcom.onSelect(); //操作引导页 var firstinfo_obj = hpcom.$("#firstinfo"); if(firstinfo_obj) { if(!cacheCookie.getItem(cache_keyword)) cacheCookie.setItem(cache_keyword,0,24); else cacheCookie.setItem(cache_keyword,(cacheCookie.getItem(cache_keyword)*1+1*1),24); if(cacheCookie.getItem(cache_keyword)==0) hpcom.show(firstinfo_obj); }; /*var branchCode=hpcom.$("#branchCode"); if(branchCode){ branchCode.onchange=function(){ var bigActCode=hpcom.$("#bigActCode"); var branchCode=hpcom.$("#branchCode"); getSubBranchs(bigActCode.value,branchCode.value); }; } var subBranchCode=hpcom.$("#subBranchCode"); if(subBranchCode){ subBranchCode.onchange=function(){ var bigActCode=hpcom.$("#bigActCode"); var branchCode=hpcom.$("#branchCode"); var subBranchCode=hpcom.$("#subBranchCode"); var stage=hpcom.$("#stageCode"); getBranchActLists(bigActCode,branchCode,subBranchCode,stage); }; }*/ // var area_obj = hpcom.$("#area"), item_2nd = hpcom.$("#city-item-2nd"), city_obj = hpcom.$("#city-ul"), city_li_obj = city_obj.getElementsByTagName("li"), city_li_len = city_li_obj.length; area_obj.onclick = function(){ if(city_obj.style.display == "block") hpcom.hide(city_obj); else{ hpcom.show(city_obj); for(var i=0;i
- 刷新
- 关闭
加载中"; var bigActCode="",branchCode=this.getAttribute("data-value"); var bigActCode_obj=hpcom.$("#bigActCode"); if(bigActCode_obj){ bigActCode=bigActCode_obj.value; } var branchCode_obj=hpcom.$("#branchCode"); if(branchCode_obj){ branchCode_obj.value=branchCode; } var data_subcount=this.getAttribute("data-subcount"); if(data_subcount=="true"){ item_2nd.style.display="block"; getSubBranchs(bigActCode,branchCode); }else{ item_2nd.style.display="none"; /*var branchName=this.getAttribute("data-branchName"); var subBranch_txt=""+branchName+" "; if(item_2nd){ item_2nd.innerHTML =subBranch_txt; //添加监听器 addSubBranchEventListener(item_2nd); }*/ //this.onclick=function(){ //预先关闭弹窗 htmldemo.closecity(); showMessage("数据正在加载中..."); var show_data=hpcom.$("#show_data"); if(show_data){ branchName=this.getAttribute("data-branchName"); show_data.innerHTML=branchName; //showWeather(branchName); } var bigActCode="",branchCode=this.getAttribute("data-value"),subBranchCode=branchCode,stageCode=""; var bigActCode_obj=hpcom.$("#bigActCode"); if(bigActCode_obj){ bigActCode=bigActCode_obj.value; } var stageCode_obj=hpcom.$("#stageCode"); if(stageCode_obj){ stageCode=stageCode_obj.value; } var subBranchCode_obj=hpcom.$("#subBranchCode"); if(subBranchCode_obj){ subBranchCode_obj.value=subBranchCode; } getBranchActLists(bigActCode,branchCode,subBranchCode,stageCode); //}; } /*data(); function data(){ //var get_data = citydata(); //加载城市数据 if(get_data) item_2nd.innerHTML = get_data; else item_2nd.innerHTML = ""; };*/ }; }; }; }; }; var userId=hpcom.$("#userId"); if(userId&&parseInt(userId.value)>0){ //return; }else{ var get_pos=""; if(cacheCookie){ get_pos=cacheCookie.getItem("act_show_get_pos"); } if(get_pos&&get_pos!=""&&parseInt(get_pos)>0){ return; }else{ getPosition(); } } var show_data=hpcom.$("#show_data"); if(show_data){ var cityName=show_data.innerHTML; showWeather(cityName); } }, closecity: function(){ //hpcom.$("#set-data").innerHTML = e.innerHTML; hpcom.hide(hpcom.$("#city-ul")); } };//over /**获得子分行列表 */ function getSubBranchs(bigActCode,branchCode){ var item_2nd = hpcom.$("#city-item-2nd"); if(item_2nd){ item_2nd.innerHTML =""; } require.async("jquery",function(){ var params={"bigActCode":bigActCode,"branchCode":branchCode}; var url=wapProtocolHttpDomain+"/icbcShowSubBranch.do"; $.ajax({ url:url, data:params, type:"post", dataType:"jsonp", jsonp:"jsonpcallback", success:function(msg){ // alert(msg); if(msg){ // alert(msg); var status=msg.status; if(status=='success'){ var icbcSubBranchBeans=msg.icbcSubBranchBeans; var subBranch_txt="" if(icbcSubBranchBeans){ for(var i=0,len=icbcSubBranchBeans.length;i
加载失败,点击重新加载"+icbcSubBranchBeans[i].subBranchName+""; } if(item_2nd){ item_2nd.innerHTML =subBranch_txt; //添加监听器 addSubBranchEventListener(item_2nd); } }else{ if(item_2nd){ item_2nd.innerHTML = " "; } } }else{ if(item_2nd){ item_2nd.innerHTML = "
加载失败,点击重新加载"; } } }else{ if(item_2nd){ item_2nd.innerHTML = "
加载失败,点击重新加载"; } } }, error:function(msg){ var item_2nd = hpcom.$("#city-item-2nd"); if(item_2nd){ item_2nd.innerHTML = "
加载失败,点击重新加载"; } } }); }); } function addSubBranchEventListener(obj){ if(obj){ var subBranch_objs = obj.getElementsByTagName("li"); for(var i=0,len=subBranch_objs.length;i
加载失败,点击重新加载0){ var act_list_txt=""; for(var i=0,len=icbcStageActListBeans.length;i act_list_txt+=" "; }else if(icbcStageActListBeans[i].appCode=='mklottery'){ // //if(act_show_clientType=="ICBC-WC"){ act_list_txt+=" "; //}else{ //act_list_txt+=" "; //} }else if(icbcStageActListBeans[i].appCode == 'dutch'){ // act_list_txt+=" "; }else if(icbcStageActListBeans[i].appCode=='auction'){ // act_list_txt+=" "; }else if(icbcStageActListBeans[i].appCode=='gather'){ // act_list_txt+=" "; } } if(branch_app_list){ branch_app_list.innerHTML=act_list_txt; } }else{ //showMessage("该地区没有活动"); if(branch_app_list){ branch_app_list.innerHTML=noActText; } } }else{ //showMessage("该地区没有活动"); if(branch_app_list){ branch_app_list.innerHTML=noActText; } } } function getBranchActLists(bigActCode,branchCode,subBranchCode,stageCode){ var sesseionCache=null; //var sesseionCache=window.sessionStorage; var branch_app_list=hpcom.$("#branch_app_list"); var noActText=" 矮油,当前地区还没有活动哦! "; if(sesseionCache){ var branchActListContent=sesseionCache.getItem("act_show_act_list_"+bigActCode+branchCode+subBranchCode+stageCode); if(branchActListContent&&branchActListContent!=""){ var msg=JSON.parse(branchActListContent); resolveBranchActLists(msg,branch_app_list,noActText); return; } } if(branch_app_list){ branch_app_list.innerHTML=""; } if(show_data){ showWeather(show_data.innerHTML); } require.async("jquery",function(){ var params={"bigActCode":bigActCode,"branchCode":branchCode,"subBranchCode":subBranchCode,"stageCode":stageCode}; var url=wapProtocolHttpDomain+"/icbcShowActList.do"; $.ajax({ url:url, data:params, type:"post", dataType:"jsonp", jsonp:"jsonpcallback", success:function(msg){ if(msg){ if(sesseionCache){ var branchActListContent=JSON.stringify(msg); sesseionCache.setItem("act_show_act_list_"+bigActCode+branchCode+subBranchCode+stageCode,branchActListContent); } resolveBranchActLists(msg,branch_app_list,noActText); }else{ //showMessage("该地区没有活动"); if(branch_app_list){ branch_app_list.innerHTML=noActText; } } //htmldemo.closecity(); }, error:function(msg){ //showMessage(msg,"error"); //showMessage("该地区没有活动"); if(branch_app_list){ branch_app_list.innerHTML=noActText; } htmldemo.closecity(); } }); }); } //获取当前的位置信息 function getPosition(){ if (window.navigator.geolocation) { var options = { enableHighAccuracy: true, }; window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options); } else { showMessage("无法定位",2); } } /** * 获取地址位置成功 */ function handleSuccess(position) { showMessage(" 正在定位...",2); //获得经度纬度 var x = position.coords.latitude; var y = position.coords.longitude; //配置Baidu Geocoding API var url = "http://api.map.baidu.com/geocoder/v2/?ak=C93b5178d7a8ebdb830b9b557abce78b&callback=renderReverse&location="+x+","+y+"&output=json&pois=0"; require.async("jquery",function(){ $.ajax({type: "GET", dataType: "jsonp", url: url, success: function (json) { if (json == null || typeof (json) == "undefined") { return; } if (json.status != "0") { return; } if(json.result){ var address=json.result.addressComponent; //省 var provinceName = address.province; //市 var cityName = address.city; //区 //var district = address.district; provinceName = provinceName.replace('市', ''); cityName = cityName.replace('市', ''); provinceName = provinceName.replace('省', ''); var branchCodes=document.querySelectorAll("#city-item > li"); var subBranchCodes=document.querySelectorAll("#city-item-2nd > li"); var branchCode="",subBranchCode="",stageCode=hpcom.$("#stageCode").value,bigActCode=hpcom.$("#bigActCode").value; if(branchCodes){ for(var i=0,len=branchCodes.length;i-1){ branchCodes[i].className="item-1nd item-border-bottom item-actived"; branchCode=branchCodes[i].getAttribute("data-value"); var data_subcount=branchCodes[i].getAttribute("data-subcount"); if(data_subcount=="true"){ getSubBranchs(bigActCode,branchCode); }else{ subBranchCode=branchCode; //alert(cityName); var subBranch_txt=" "+cityName+" "; var item_2nd = hpcom.$("#city-item-2nd"); if(item_2nd){ item_2nd.innerHTML =subBranch_txt; //添加监听器 addSubBranchEventListener(item_2nd); } var show_data=hpcom.$("#show_data"); if(show_data){ show_data.innerHTML=cityName; //showWeather(cityName); } } break; } } } //alert(subBranchCode); if(subBranchCode==""){ if(subBranchCodes){ for(var i=0,len=subBranchCodes.length;i-1){ subBranchCode=subBranchCodes[i].getAttribute("data-value"); var show_data=hpcom.$("#show_data"); if(show_data){ show_data.innerHTML=branchName; //showWeather(branchName); } break; } } } } //alert(subBranchCode); //根据定位获取分行活动 getBranchActLists(bigActCode,branchCode,subBranchCode,stageCode); if(cacheCookie){ cacheCookie.setItem("act_show_get_pos",1,24); } } }, error: function (msg) { //showMessage("定位地区失败,请手动选择地区"); } }); }); } function showCookie(){ this.getItem=function(key){ return getCookie(key); }; this.setItem=function(key,value,hour){ addCookie(key,value,hour); }; } function getCookie(objName){//获取指定名称的cookie的值 var arrStr = document.cookie.split("; "); for(var i = 0;i < arrStr.length;i ++){ var temp = arrStr[i].split("="); if(temp[0] == objName) return unescape(temp[1]); } } function addCookie(objName,objValue,objHours){ //添加cookie var str = objName + "=" + escape(objValue); if(objHours > 0){ //为时不设定过期时间,浏览器关闭时cookie自动消失 var date = new Date(); var ms = objHours*3600*1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } function showMessage(msg,type){ /*var find=hpcom.$("#find"); if(find){ var showMsg=" "; find.innerHTML=showMsg; find.style.display="block"; var show_submit_btn=hpcom.$("#show_submit_btn"); if(show_submit_btn){ show_submit_btn.onclick=function(){ find.style.display="none"; } } }*/ if(!type){ type=2; } require.async("alert",function(){ new PointOut(msg,type); }); } function handleError(error){ showMessage("无法定位",2); //showMessage("定位地区失败,请手动选择地区","info"); } //获取城市AQI function showWeather(cityName){ var act_show="act_show_"; require.async("jquery",function(){ var index=cityName.indexOf("("); if(index<0){ index=cityName.indexOf("("); } if(index>-1){ cityName=cityName.substring(0,index); } cityName=$.trim(cityName); if(cache){ var aqi=cache.getItem(act_show+cityName); if(aqi&&aqi!=""){ showWeatherDiv(aqi); return; } } require.async("./city_weather_json",function(){ if(city_weather_json){ //alert(cityName); var cityId=city_weather_json[cityName]; //(cityId); var url="http://www.pm25.in/api/querys/pm2_5.json?city="+cityId+"&token=UtzrAKmb7zS43bZ51kb3&stations=no"; $.ajax({type: "GET", dataType:"jsonp", url: url, success: function (msg) { //alert(msg); if(msg){ var error=msg.error; if(!error){ var aqi=msg[0].aqi; showWeatherDiv(aqi); if(cache){ cache.setItem(act_show+cityName,aqi); } } } }, error: function (msg) { } }); } }); }); } function showWeatherDiv(msg){ var aqi_show_data=hpcom.$("#aqi_show_data"); if(aqi_show_data){ //alert(msg[0].aqi); aqi_show_data.innerHTML="所在地区AQI指数:"+msg; } } //调用部分 require.async("alert",function(){}); //提示插件 seajs.use("style.alert"); //提示插件 var htmldemo = new hoteljs(); banner(); setTimeout(function(){htmldemo.loaded()},0); //酒店预订页面效果调用 (交互演示) function banner(){ var blockswitching_obj = hpcom.$("#commonbannerpics"); if(blockswitching_obj){ require("swipeview.blockswitching"); //插件部分(图片切换,循环切换模式) var uedobj2nd = new BlockSwitching(); uedobj2nd.config("commonbannerpics","commonbannerpicsnums",3000,false); //插件参数配置(图片切换,循环切换模式) //调用部分 over blockswitching_obj.style.height = hpcom.winSize(1)*260/640+"px"; }; }; //调用部分 over window.htmldemo = htmldemo; module.exports = htmldemo; }); city_weather_json.js var city_weather_json={"北京":"beijing","上海":"shanghai","天津":"tianjin","重庆":"chongqing" ,"香港":"xianggan","澳门":"aomen" ,"黑龙江":"haerbin","哈尔滨":"haerbin","齐齐哈尔":"qiqihaer","牡丹江":"mudanjiang","大庆":"daqing","伊春":"yichun","双鸭山":"shuangyashan","鹤岗":"hegang","鸡西":"jixi","佳木斯":"jiamusi","七台河":"qitaihe","黑河":"heihe","绥化":"suihua","大兴安岭":"daxinganling" ,"吉林":"changchun","长春":"changchun","延吉":"yanji","吉林":"jilin","白山":"baishan","白城":"baicheng","四平":"siping","松原":"songyuan","辽源":"liaoyuang","大安":"daan","通化":"tonghua" ,"辽宁":"shenyang","沈阳":"shenyang","大连":"dalian","葫芦岛":"huludao","盘锦":"panjin","本溪":"benxi","抚顺":"fushun","铁岭":"tieling","辽阳":"liaoyang","营口":"yingkou","阜新":"buxin","朝阳":"chanyang","锦州":"jinzhou","丹东":"dandong","鞍山":"anshan" ,"内蒙古":"huhehaote","内蒙":"huhehaote","呼和浩特":"huhehaote","呼伦贝尔":"hulunbeer","锡林浩特":"xilinhaote","包头":"baotou","赤峰":"chifeng","海拉尔":"hailaer","乌海":"wuhai","鄂尔多斯":"eerduosi","通辽":"tongliao" ,"河北":"shijiazhuang","石家庄":"shijiazhuang","唐山":"tangshan","张家口":"zhangjiakou","廊坊":"langfang","邢台":"xingtai","邯郸":"handan","沧州":"cangzhou","衡水":"hengshui","承德":"chengde","保定":"baoding","秦皇岛":"qinhuangdao" ,"河南":"zhengzhou","郑州":"zhengzhou","开封":"kaifeng","洛阳":"luoyan","平顶山":"pingdingshan","焦作":"jiaozuo","鹤壁":"hebi","新乡":"xinxiang","安阳":"anyang","濮阳":"puyang","许昌":"xuchang","漯河":"luohe","三门峡":"sanmenxia","南阳":"nanyang","商丘":"shangqiu","信阳":"xinyang","周口":"zhoukou","驻马店":"zhumadian" ,"宁夏":"yinchuan","银川":"yinchuan","固原":"guyuan","中卫":"zhongwei","石嘴山":"shizuishan","吴忠":"wuzhong" ,"青海":"xining","西宁":"xining","海北":"haibei","海西":"haixi","黄南":"huangnan","果洛":"guoluo","玉树":"yushu","海东":"haidong","海南":"hainang" ,"湖北":"wuhan","武汉":"wuhan","宜昌":"yichang","黄冈":"huanggang","恩施":"enshi","荆州":"jingzhou","神农架":"shennongjia","十堰":"shiyan","咸宁":"weining","襄阳":"xiangyang","孝感":"xiaogan","随州":"suizhou","黄石":"huangshi","荆门":"jinmen","鄂州":"ezhou" ,"湖南":"changsha","长沙":"changsha","邵阳":"shaoyang","常德":"changde","郴州":"chengzhou","吉首":"jishou","株洲":"zhuzhou","娄底":"loudi","湘潭":"xiangtan","益阳":"yiyang","永州":"yongzhou","岳阳":"yueyang","衡阳":"hengyang","怀化":"huaihua","韶山":"shaoshan","张家界":"zhangjiajie" ,"浙江":"hangzhou","杭州":"hangzhou","湖州":"huzhou","金华":"jinhua","宁波":"ningbo","丽水":"lishui","绍兴":"shaoxing","衢州":"quzhou","嘉兴":"jiaxing","台州":"taizhou","舟山":"zhoushan","温州":"weizhou" ,"江西":"nanchang","南昌":"nanchang","萍乡":"pingxiang","九江":"jiujiang","上饶":"shangrao","抚州":"fuzhou","吉安":"jian","鹰潭":"yintang","宜春":"yichun","新余":"xinyu","景德镇":"jingdezhen","赣州":"ganzhou" ,"福建":"fuzhou","福州":"fuzhou","厦门":"xiamen","龙岩":"longyan","南平":"nanping","宁德":"ningde","莆田":"putian","泉州":"quanzhou","三明":"sanming","漳州":"zhangzhou" ,"贵州":"guiyang","贵阳":"guiyang","安顺":"anshun","赤水":"chishui","遵义":"zuiyi","铜仁":"tongren","六盘水":"liupanshui","毕节":"bijie","凯里":"kaili","都匀":"duyun" ,"海南":"haikou","海口":"haikou","三亚":"sanya","儋州":"danzhou","琼山":"qiongshan","通什":"tongza","文昌":"wenchang" ,"新疆":"wulumuqi","乌鲁木齐":"wulumuqi","阿勒泰":"aletai","阿克苏":"akesu","昌吉":"changji","哈密":"hami","和田":"hetian","喀什":"kashi","克拉玛依":"kelamayi","石河子":"shihezi","塔城":"tacheng","库尔勒":"kuerle","吐鲁番":"tulufan","伊宁":"yining" ,"西藏":"lasa","拉萨":"lasa","阿里":"ali","昌都":"changdu","那曲":"naqu","日喀则":"rikaze","山南":"shannan","林芝":"linzhi" ,"台湾":"taibei","台北":"taibei","高雄":"gaoxiong" ,"云南":"kunming","昆明":"kunming","保山":"baoshan","楚雄":"chuxiong","德宏":"dehong","红河":"honghe","临沧":"lincang","怒江":"nujiang","曲靖":"qujing","思茅":"simao","文山":"wenshan","玉溪":"yuxi","昭通":"zhaotong","丽江":"lijiang","大理":"dali" ,"山东":"jinan","济南":"jinan","青岛":"qingdao","淄博":"zibo","威海":"weihai","曲阜":"qufu","临沂":"linyi","烟台":"yantai","枣庄":"zaozhuang","聊城":"liaocheng","济宁":"jining","菏泽":"heze","泰安":"taian","日照":"rizhao","东营":"dongying","德州":"dezhou","滨州":"binzhou","莱芜":"laiwu","潍坊":"weifang" ,"山西":"taiyuan","太原":"taiyuan","阳泉":"yangquan","晋城":"jincheng","晋中":"jinzhong","临汾":"linfen","运城":"yuncheng","长治":"changzhi","朔州":"shuozhou","忻州":"xinzhou","大同":"datong","吕梁":"lvliang" ,"江苏":"nanjing","南京":"nanjing","苏州":"suzhou","昆山":"kunshan","南通":"nantong","太仓":"taicang","吴县":"wuxian","徐州":"xuzhou","宜兴":"yixing","镇江":"zhenjiang","淮安":"huaian","常熟":"changshu","盐城":"yancheng","泰州":"taizhou","无锡":"wuxi","连云港":"lianyungang","扬州":"yangzhou","常州":"changzhou","宿迁":"suqian" ,"安徽":"hefei","合肥":"hefei","巢湖":"chaohu","蚌埠":"bengbu","安庆":"anqing","六安":"luan","滁州":"xuzhou","马鞍山":"maanshan","阜阳":"fuyang","宣城":"xuancheng","铜陵":"tongling","淮北":"huaibei","芜湖":"wuhu","毫州":"haozhou","宿州":"suzhou","淮南":"huainan","池州":"chizhou" ,"陕西":"xian","西安":"xian","韩城":"hancheng","安康":"ankang","汉中":"hangzhong","宝鸡":"baoji","咸阳":"xianyang","榆林":"yulin","渭南":"weinan","商洛":"shangluo","铜川":"tongchuan","延安":"yanan" ,"甘肃":"lanzhou","兰州":"lanzhou","白银":"baiyin","庆阳":"qingyang","酒泉":"jiuquan","天水":"tianshui","武威":"wuwei","张掖":"zhangye","甘南":"gansu","临夏":"linxia","平凉":"pingliang","定西":"dingxi","金昌":"jinchang" ,"四川":"chengdu","成都":"chengdu","泸州":"luzhou","内江":"neijiang","凉山":"liangshan","阿坝":"aba","巴中":"bazhong","广元":"guangyuan","乐山":"yueshan","绵阳":"mianyang","德阳":"deyan","攀枝花":"panzhihua","雅安":"yaan","宜宾":"yibin","自贡":"zigong","甘孜州":"ganzizhou","达州":"dazhou","资阳":"ziyang","广安":"guangan","遂宁":"suining","眉山":"meishan","南充":"nanchong" ,"广东":"guangzhou","广州":"guangzhou","深圳":"shenzhen","潮州":"chaozhou","韶关":"shaoguan","湛江":"zhanjiang","惠州":"huizhou","清远":"qingyuan","东莞":"dongguan","江门":"jiangmen","茂名":"maomin","肇庆":"zhaoqing","汕尾":"shanwei","河源":"heyuan","揭阳":"jieyang","梅州":"meizhou","中山":"zhongshan","德庆":"deqing","阳江":"yangjiang","云浮":"yunfu","珠海":"zhuhai","汕头":"shantou","佛山":"foshan" ,"广西":"nanning","南宁":"nanning","桂林":"guilin","阳朔":"yangshuo","柳州":"liuzhou","梧州":"wuzhou","玉林":"yulin","桂平":"guiping","贺州":"hezhou","钦州":"qinzhou","贵港":"guigang","防城港":"fangchenggang","百色":"baise","北海":"beihai","河池":"hechi","来宾":"laibin","崇左":"chongzhuo" }; /* var city_weather_json={"北京":"101010100","上海":"101020100","天津":"101030100","重庆":"101040100" ,"香港":"101320101","澳门":"101330101" ,"黑龙江":"101050101","哈尔滨":"101050101","齐齐哈尔":"101050201","牡丹江":"101050301","大庆":"101050901","伊春":"101050801","双鸭山":"101051301","鹤岗":"101051201","鸡西":"101051101","佳木斯":"101050401","七台河":"101051002","黑河":"101050601","绥化":"101050501","大兴安岭":"101050701" ,"吉林":"101060101","长春":"101060101","延吉":"101060301","吉林":"101060201","白山":"101060901","白城":"101060601","四平":"101060401","松原":"101060801","辽源":"101060701","大安":"101060603","通化":"101060501" ,"辽宁":"101070101","沈阳":"101070101","大连":"101070201","葫芦岛":"101071401","盘锦":"101071301","本溪":"101070501","抚顺":"101070401","铁岭":"101071101","辽阳":"101071001","营口":"101070801","阜新":"101070901","朝阳":"101071201","锦州":"101070701","丹东":"101070601","鞍山":"101070301" ,"内蒙古":"101080101","呼和浩特":"101080101","呼伦贝尔":"101081000","锡林浩特":"101080901","包头":"101080201","赤峰":"101080601","海拉尔":"101081001","乌海":"101080301","鄂尔多斯":"101080701","通辽":"101080501" ,"河北":"101090101","石家庄":"101090101","唐山":"101090501","张家口":"101090301","廊坊":"101090601","邢台":"101090901","邯郸":"101091001","沧州":"101090701","衡水":"101090801","承德":"101090402","保定":"101090201","秦皇岛":"101091101" ,"河南":"101180101","郑州":"101180101","开封":"101180801","洛阳":"101180901","平顶山":"101180501","焦作":"101181101","鹤壁":"101181201","新乡":"101180301","安阳":"101180201","濮阳":"101181301","许昌":"101180401","漯河":"101181501","三门峡":"101181701","南阳":"101180701","商丘":"101181001","信阳":"101180601","周口":"101181401","驻马店":"101181601" ,"宁夏":"101170101","银川":"101170101","固原":"101170401","中卫":"101170501","石嘴山":"101170201","吴忠":"101170301" ,"青海":"101150101","西宁":"101150101","海北":"101150801","海西":"101150701","黄南":"101150301","果洛":"101150501","玉树":"101150601","海东":"101150201","海南":"101150401" ,"湖北":"101200101","武汉":"101200101","宜昌":"101200901","黄冈":"101200501","恩施":"101201001","荆州":"101200801","神农架":"101201201","十堰":"101201101","咸宁":"101200701","襄阳":"101200201","孝感""101200401","随州":"101201301","黄石":"101200601","荆门":"101201401","鄂州":"101200301" ,"青海":"101250101","长沙":"101250101","邵阳":"101250901","常德":"101250601","郴州":"101250501","吉首":"101251501","株洲":"101250301","娄底":"101250801","湘潭":"101250201","益阳":"101250701","永州":"101251401","岳阳":"101251001","衡阳":"101250401","怀化":"101251201","韶山":"101250202","张家界":"101251101" ,"浙江":"101210101","杭州":"101210101","湖州":"101210201","金华":"101210901","宁波":"101210401","丽水":"101210801","绍兴":"101210501","衢州":"101211001","嘉兴":"101210301","台州":"101210601","舟山":"101211101","温州":"101210701" ,"江西":"101240101","南昌":"101240101","萍乡":"101240901","九江":"101240201","上饶":"101240301","抚州":"101240401","吉安":"101240601","鹰潭":"101241101","宜春":"101240501","新余":"101241001","景德镇":"101240801","赣州":"101240701" ,"福建":"101230101","福州":"101230101","厦门":"101230201","龙岩":"101230701","南平":"101230901","宁德":"101230301","莆田":"101230401","泉州":"101230501","三明":"101230801","漳州":"101230601" ,"贵州":"101260101","贵阳":"101260101","安顺":"101260301","赤水":"101260208","遵义":"101260201","铜仁":"101260601","六盘水":"101260801","毕节":"101260701","凯里":"101260501","都匀":"101260401" ,"海南":"101310101","海口":"101310101","三亚":"101310201","儋州":"101310205","琼山":"101310102","通什":"101310222","文昌":"101310212" ,"新疆":"101130101","乌鲁木齐":"101130101","阿勒泰":"101131401","阿克苏":"101130801","昌吉":"101130401","哈密":"101131201","和田":"101131301","喀什":"101130901","克拉玛依":"101130201","石河子":"101130301","塔城":"101131101","库尔勒":"101130601","吐鲁番":"101130501","伊宁":"101131001" ,"西藏":"101140101","拉萨":"101140101","阿里":"101140701","昌都":"101140501","那曲":"101140601","日喀则":"101140201","山南":"101140301","林芝":"101140401" ,"台湾":"101340102","台北":"101340102","高雄":"101340201" ,"云南":"101290101","昆明":"101290101","保山":"101290501","楚雄":"101290801","德宏":"101291501","红河":"101290301","临沧":"101291101","怒江":"101291201","曲靖":"101290401","思茅":"101290901","文山":"101290601","玉溪":"101290701","昭通":"101291001","丽江":"101291401","大理":"101290201" ,"山东":"101120101","济南":"101120101","青岛":"101120201","淄博":"101120301","威海":"101121301","曲阜":"101120710","临沂":"101120901","烟台":"101120501","枣庄":"101121401","聊城":"101121701","济宁":"101120701","菏泽":"101121001","泰安":"101120801","日照":"101121501","东营":"101121201","德州":"101120401","滨州":"101121101","莱芜":"101121601","潍坊":"101120601" ,"山西":"101100101","太原":"101100101","阳泉":"101100301","晋城":"101100601","晋中":"101100401","临汾":"101100701","运城":"101100801","长治":"101100501","朔州":"101100901","忻州":"101101001","大同":"101100201","吕梁":"101101101" ,"江苏":"101190101","南京":"101190101","苏州":"101190401","昆山":"101190404","南通":"101190501","太仓":"101190408","吴县":"101190406","徐州":"101190801","宜兴":"101190203","镇江":"101190301","淮安":"101190901","常熟":"101190402","盐城":"101190701","泰州":"101191201","无锡":"101190201","连云港":"101191001","扬州":"101190601","常州":"101191101","宿迁":"101191301" ,"安徽":"101220101","合肥":"101220101","巢湖":"101221601","蚌埠":"101220201","安庆":"101220601","六安":"101221501","滁州":"101221101","马鞍山":"101220501","阜阳":"101220801","宣城":"101221401","铜陵":"101221301","淮北":"101221201","芜湖":"101220301","毫州":"101220901","宿州":"101220701","淮南":"101220401","池州":"101221701" ,"陕西":"101110101","西安":"101110101","韩城":"101110510","安康":"101110701","汉中":"101110801","宝鸡":"101110901","咸阳":"101110200","榆林":"101110401","渭南":"101110501","商洛":"101110601","铜川":"101111001","延安":"101110300" ,"甘肃":"101160101","兰州":"101160101","白银":"101161301","庆阳":"101160401","酒泉":"101160801","天水":"101160901","武威":"101160501","张掖":"101160701","甘南":"101050204","临夏":"101161101","平凉":"101160301","定西":"101160201","金昌":"101160601" ,"四川":"101270101","成都":"101270101","泸州":"101271001","内江":"101271201","凉山":"101271601","阿坝":"101271901","巴中":"101270901","广元":"101272101","乐山":"101271401","绵阳":"101270401","德阳":"101272001","攀枝花":"101270201","雅安":"101271701","宜宾":"101271101","自贡":"101270301","甘孜州":"101271801","达州":"101270601","资阳":"101271301","广安":"101270801","遂宁":"101270701","眉山":"101271501","南充":"101270501" ,"广东":"101280101","广州":"101280101","深圳":"101280601","潮州":"101281501","韶关":"101280201","湛江":"101281001","惠州":"101280301","清远":"101281301","东莞":"101281601","江门":"101281101","茂名":"101282001","肇庆":"101280901","汕尾":"101282101","河源":"101281201","揭阳":"101281901","梅州":"101280401","中山":"101281701","德庆":"101280905","阳江":"101281801","云浮":"101281401","珠海":"101280701","汕头":"101280501","佛山":"101280800" ,"广西":"101300101","南宁":"101300101","桂林":"101300501","阳朔":"101300510","柳州":"101300301","梧州":"101300601","玉林":"101300901","桂平":"101300802","贺州":"101300701","钦州":"101301101","贵港":"101300801","防城港":"101301401","百色":"101301001","北海":"101301301","河池":"101301201","来宾":"101300401","崇左":"101300201" }; 中国国家气象局天气预报接口总共提供了三个: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data/cityinfo/101010100.html http://m.weather.com.cn/data/101010100.html 最详细的信息来自第三个接口。上面url中的101010100是城市代码,这里是北京的城市代码。只需要改变城市代码,就可以得到所在城市的天气信息。笔者在福州,所以选择的城市代码是福州101230101。 在浏览器上输入url:http://m.weather.com.cn/data/101230101.html得到信息,天气信息是json的数据格式,数据如下: {"weatherinfo":{"city":"福州","city_en":"fuzhou","date_y":"2012年5月14日","date":"","week":"星期一","fchh":"08","cityid":"101230101","temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃","tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉","weather1":"阵雨转中雨","weather2":"中雨转小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨转阵雨","weather6":"阵雨转小雨","img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3","img_title1":"阵雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"阵雨","img_title11":"阵雨","img_title12":"小雨","img_title_single":"阵雨","wind1":"微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风","fx1":"微风","fx2":"微风","fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级","index":"热","index_d":"天气较热,建议着短裙、短裤、短套装、T恤等夏季服装。年老体弱者宜着长袖衬衫和单裤。","index48":"暖","index48_d":"较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。","index_uv":"弱","index48_uv":"最弱","index_xc":"不宜","index_tr":"适宜","index_co":"较不舒适","st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18","index_cl":"较不宜","index_ls":"不太适宜","index_ag":"不易发"}} */"+msg+"
"; showMsg+=""; showMsg+="