Call QQ weather forecast function code
var minisite = new Object ();
Minisite.browser = {
ie:/msie/.test (window.navigator.userAgent.toLowerCase ()),
Moz:/gecko/.test (Window.navigator.userAgent.toLowerCase ()),
Opera:/opera/.test (Window.navigator.userAgent.toLowerCase ())
};
minisite.$ = function (s)
{
return (typeof s = = ' object ')? S:document.getelementbyid (s);
};
Minisite.jsloader = {
Load:function (sURL, Fcallback)
{
var _script = document.createelement (' script ');
_script.setattribute (' type ', ' text/javascript tutorial ');
_script.setattribute (' src ', surl);
_script.setattribute (' CharSet ', ' gb2312 ');
document.getElementsByTagName (' head ') [0].appendchild (_script);
if (MiniSite.Browser.ie)
{
_script.onreadystatechange = function ()
{
if (this.readystate== ' Loaded ' | | | | this.readystate== ' complete ')
{
Fcallback ();
}
};
}
else if (MINISITE.BROWSER.MOZ)
{
_script.onload = function ()
{
Fcallback ();
};
}
Else
{
Fcallback ();
}
}
};
Minisite.cookie = {
Set:function (name, value, expires, path, domain)
{
if (typeof expires = = "undefined")
{
expires = new Date (new Date (). GetTime () + 1*3600*100);
}
Document.cookie = name + "=" + Escape (value) +
((expires)? "; Expires= "+ expires.togmtstring ():" ") +
((path)? "; Path= "+ Path:"; path=/") +
(domain)? "; domain= "+ Domain:" "");
},
Get:function (name)
{
var arr = Document.cookie.match (New RegExp ("(^|)" +name+ "= ([^;] *)(;|$)"));
if (arr!= null)
{
Return unescape (arr[2]);
}
return null;
},
Clear:function (name, path, domain)
{
if (this.get (name))
{
Document.cookie = name + "=" +
((path)? "; Path= "+ Path:"; path=/") +
(domain)? "; domain= "+ Domain:" "") +
"; Expires=fri, 02-jan-1970 00:00:00 GMT";
}
}
};
Minisite.weather = {
defaultcity:125,
City: {
"Beijing": {
"_": 125,
"Beijing": 125
},
"Shanghai City": {
"_": 252,
"Shanghai City": 252
},
"Tianjin": {
"_": 127,
"Tianjin": 127,
"Tanggu District": 132
},
"Chongqing City": {
"_": 212,
"Fengjie District": 201,
"Chongqing City": 212,
"Fuling District": 213
},
"Hong Kong": {
"_": 1,
"Hong Kong": 1
},
"Macau": {
"_": 2,
"Macau": 2
},
"Taiwan Province": {
"_": 280,
"Taipei City": 280
},
"Yunnan Province": {
"_": 179,
"Zhaotong": 173,
"Lijiang City": 174,
"Qujing": 175,
"Baoshan": 176,
"Dali Prefecture": 177,
"Chuxiong Prefecture": 178,
"Kunming": 179,
"Ruili": 180,
"Yuxi": 181,
"Lincang City": 182,
"Simao": 184,
"Honghe": 185,
"Wenshan": 369,
"Xishuangbanna State": 370,
"Dehong": 371,
"Nu River State": 372,
"Diqing": 373
},
"Inner Mongolia": {
"_": 69,
"Holonbuyr": 4,
"Hinggan League": 7,
"Xilin Gol": 16,
"Bayan nur City": 63,
"Baotou": 64,
"Hohhot City": 69,
"Xilin Hot": 99,
"Tongliao": 101,
"Chifeng": 106,
"Wuhai": 382,
"Eerduosi": 383,
"Wulanchabu City": 384
},
"Jilin Province": {
"_": 103,
"Liaoyuan": 34,
"Tonghua": 36,
"White City": 37,
"Songyuan": 96,
"Changchun": 103,
"Jilin": 104,
"Huadian": 109,
"Yanbian State": 110,
"Jian": 118,
"Bss": 119,
"Siping": 385
},
"Sichuan Province": {
"_": 166,
"Ganzi State": 162,
"ABA": 163,
"Chengdu City": 166,
"Mianyang": 167,
"Yaan": 168,
"Emeishan": 170,
"Leshan": 171,
"Yibin": 172,
"Bazhong": 199,
"Dazhou": 200,
"Suining": 204,
"Nanchong": 205,
"Luzhou": 216,
"Zigong": 359,
"Panzhihua": 360,
"Deyang": 361,
"Guangyuan": 362,
"Neijiang": 363,
"Guangan": 364,
"Meishan": 365,
"Ziyang": 366,
"Liangshan Prefecture": 367
},
"Ningxia": {
"_": 78,
"Shizuishan": 54,
"Yinchuan": 78,
"Wuzhong": 83,
"Guyuan": 209
},
"Anhui Province": {
"_": 248,
"Huainan": 75,
"Maanshan": 76,
"Huaibei": 77,
"Tongling": 92,
"Chuzhou": 95,
"Chaohu": 100,
"Chizhou": 102,
"Xuancheng": 105,
"Bozhou": 238,
"Suzhou": 239,
"Fuyang": 241,
"Liu'an": 242,
"Bangbu": 243,
"Hefei": 248,
"Wuhu": 249,
"Anqing": 253,
"Huangshan": 254
},
"Shandong Province": {
"_": 140,
"Dezhou": 134,
"Binzhou": 135,
"Yantai": 136,
"Liaocheng": 139,
"Jinan": 140,
"Taian": 141,
"Zibo": 142,
"Weifang": 143,
"Qingdao": 144,
"Jining": 146,
"Rizhao": 147,
"Taishan City": 156,
"Zaozhuang": 159,
"Dongying": 160,
"Weihai": 164,
"Laiwu": 165,
"Linyi": 183,
"Heze": 206
},
"Shanxi Province": {
"_": 84,
"Changzhi": 9,
"Jinzhong": 22,
"Shuozhou": 70,
"Datong": 72,
"Luliang City": 80,
"Xinzhou": 81,
"Taiyuan City": 84,
"Yangquan": 85,
"Linfen": 88,
"City of Transport": 93,
"Jincheng": 94,
"Five Taishan": 381
},
"Guangdong province": {
"_": 292,
"Nanxiong": 235,
"Shaoguan": 283,
"Qingyuan": 284,
"Meizhou": 285,
"Zhaoqing": 291,
"Guangzhou": 292,
"Heyuan": 293,
"Shantou": 294,
"Shenzhen": 296,
"Shanwei": 297,
"Zhanjiang": 300,
"Yangjiang": 301,
"Maoming": 302,
"Fogang City": 322,
"Mei": 323,
"Dianbai City": 324,
"Gaoyao": 325,
"Zhuhai": 330,
"Foshan": 331,
"Jiangmen": 332,
"Dongguan": 334,
"Zhongshan": 335,
"Chaozhou": 336,
"Jieyang": 337,
"Yunfu": 338
},
"Guangxi": {
"_": 295,
"Guilin": 232,
"Hechi": 281,
"Liuzhou": 282,
"Baise": 288,
"Guigang": 289,
"Wuzhou": 290,
"Nanning": 295,
"Qinzhou": 298,
"Beihai": 299,
"Fangchenggang": 339,
"Yulin": 340,
"Hezhou": 341,
"Guest City": 342,
"Chongzuo City": 343
},
"Xinjiang": {
"_": 28,
"Changji State": 19,
"Kizilsu Kirgiz Zizhizhou": 20,
"Ili state": 21,
"Aral City": 23,
"Karamay": 24,
"Bortala State": 27,
"Urumqi": 28,
"Tulufan": 31,
"Akesu": 32,
"Shihezi": 33,
"Kashi": 35,
"Hetian": 39,
"Hami": 41,
"Qitai City": 52
},
"Jiangsu Province": {
"_": 244,
"Wuxi": 43,
"Suzhou": 44,
"Xuyi City": 45,
"Ganyu City": 46,
"Dongtai": 47,
"Gaoyou": 53,
"Zhenjiang": 59,
"Taizhou": 61,
"Suqian": 62,
"Xuzhou": 236,
"Lianyungang": 237,
"Huaian": 240,
"Nanjing": 244,
"Yangzhou": 245,
"Yancheng": 246,
"Nantong": 247,
"Changzhou": 250
},
"Jiangxi Province": {
"_": 264,
"Lushan City": 111,
"Yushan City": 137,
"Guixi": 138,
"Guangchang City": 145,
"Pingxiang": 153,
"Xinyu": 154,
"Yichun": 224,
"Ganzhou": 234,
"Jiujiang": 258,
"Jingdezhen": 259,
"Nanchang": 264,
"Yingtan": 265,
"Shangrao": 267,
"Fuzhou": 273
},
"Hebei province": {
"_": 82,
"Hanhan": 3,
"Hengshui": 8,
"Shijiazhuang City": 82,
"Xingtai": 86,
"Zhangjiakou City": 120,
"Chengde": 121,
"Qinhuangdao Shi": 122,
"Langfang": 126,
"Tangshan": 128,
"Baoding": 130,
"Cangzhou": 131
},
"Henan province": {
"_": 189,
"Anyang": 89,
"Sanmenxia Shi": 188,
"Zhengzhou": 189,
"Nanyang": 192,
"Zhoukou": 193,
"Zhumadian": 197,
"Xinyang": 198,
"Kaifeng": 207,
"Luoyang": 228,
"Pingdingshan": 231,
"Jiaozuo": 251,
"Hebi": 260,
"Xinxiang": 304,
"Puyang": 305,
"Xuchang": 306,
"Leihe": 307,
"Shangqiu": 308,
"Jiyuan": 309
},
"Zhejiang province": {
"_": 255,
"Huzhou": 65,
"Shengzhou": 66,
"Pinghu": 67,
"Stone Pu": 68,
"Ninghai City": 71,
"Dongtou City": 73,
"Zhoushan": 74,
"Hangzhou City": 255,
"Jiaxing": 256,
"Dinghai City": 257,
"Jinhua": 261,
"Shaoxing": 262,
"Ningbo": 263,
"Quzhou": 266,
"Lishui": 268,
"Taizhou": 269,
"Wenzhou": 272
},
"Hainan Province": {
"_": 303,
"Haikou": 303,
"Sanya": 344,
"Tunchang City": 345,
"Qionghai": 346,
"Zhanzhou": 347,
"Wenchang": 348,
"Wanning": 349,
"Oriental City": 350,
"Chengmai City": 351,
"Dingan City": 352,
"Lingao City": 353,
"Baisha County": 354,
"Li-autonomous": 355,
"Lingshuix County": 356,
"Baoting County": 357,
"Qiongzhongzzx County": 358
},
"Hubei Province": {
"_": 211,
"Xiangfan": 196,
"Jingmen": 202,
"Huanggang": 203,
"Enshi Autonomous Prefecture": 208,
"Wuhan City": 211,
"Huangshi": 310,
"Ezhou": 314,
"Xiaogan": 315,
"Xianning": 316,
"Suizhou": 317,
"Xiantao": 318,
"Tianmen": 319,
"Qianjiang": 320,
"Shennongjia City": 321
},
"Hunan Province": {
"_": 218,
"Zhangjiajie": 214,
"Yueyang": 215,
"Huaihua": 217,
"Changsha": 218,
"Shaoyang": 222,
"Yiyang": 223,
"Chenzhou": 233,
"Sangzhi City": 311,
"Yuanling City": 312,
"Nanyue City": 313,
"Zhuzhou": 326,
"Xiangtan": 327,
"Hengyang": 328,
"Loudi": 329,
"Changde": 387
},
"Gansu Province": {
"_": 57,
"Zhangye": 49,
"Jinchang": 50,
"Wuwei": 51,
"Lanzhou City": 57,
"Baiyin": 58,
"Dingxi City": 60,
"Pingliang": 90,
"Qingyang City": 91,
"Gan nan": 225,
"Linxia": 229,
"Tianshui": 377,
"Jiayuguan": 378,
"Jiuquan": 379,
"Longnan": 380
},
"Fujian province": {
"_": 276,
"Putian": 107,
"Pu City": 271,
"Nanping": 274,
"Ningde": 275,
"Fuzhou": 276,
"Longyan": 277,
"Sanming": 278,
"Quanzhou": 279,
"Zhangzhou": 286,
"Xiamen City": 287
},
"Tibet": {
"_": 150,
"Nagchu": 148,
"Xigazê": 149,
"Lasa": 150,
"Shannan": 151,
"Ali": 152,
"Changdu": 161,
"Linzhi": 169
},
"Guizhou Province": {
"_": 227,
"Bijie": 219,
"Zunyi": 220,
"Tongren": 221,
"Anshun": 226,
"Guiyang": 227,
"Southwestern Guizhou": 230,
"Liupanshui": 368
},
"Liaoning Province": {
"_": 115,
"Huludao": 25,
"Panjin": 26,
"Liaoyang": 29,
"Tieling": 30,
"Fuxin": 108,
"Chaoyang": 112,
"Jinzhou": 113,
"Anshan": 114,
"Shenyang City": 115,
"Benxi": 116,
"Fushun": 117,
"Yingkou": 123,
"Dandong": 124,
"Wafangdian": 129,
"Dalian": 133
},
"Shaanxi Province": {
"_": 186,
"Yulin": 79,
"Yanan": 87,
"Xi ' an City": 186,
"Weinan": 187,
"Hanzhong": 190,
"Shangluo": 191,
"Ankang": 194,
"Tongchuan": 374,
"Baoji": 375,
"Xianyang": 376
},
"Qinghai": {
"_": 56,
"Haibeizhou": 48,
"Hainan State": 55,
"Xining City": 56,
"Yushu": 155,
"Huangnan State": 157,
"Goa State": 158,
"Haixizhou": 195,
"Haidong City": 210
},
"Heilongjiang Province": {
"_": 17,
"Daxinganling": 5,
"Heihe": 6,
"Qiqihar": 10,
"Suihua": 11,
"Hegang": 12,
"Jiamusi": 13,
"Yichun": 14,
"Shuangyashan": 15,
"Harbin City": 17,
"Jixi": 18,
"The City of Mohe": 38,
"Daqing": 40,
"Qitaihe Shi": 42,
"Mudanjiang": 97,
"Suifenhe": 98
}
},
_print:function (province, city, Conainter)
{
if (typeof this.city[province]!= "undefined")
{
if (typeof this.city[province][city]!= "undefined")
{
var _city_ = this.city[province][city];
}
else if (typeof this.city[province]["_"]!= "undefined")
{
var _city_ = this.city[province]["_"];
}
Else
{
var _city_ = this.defaultcity;
}
}
Else
{
var _city_ = this.defaultcity;
}
MiniSite.JsLoader.load ("Http://weather.news.qq.com/inc/minisite_" +_city_+ ". js" + "? tt=" + (new Date ()). GetTime (), function ()
{
Try
{
minisite.$ (conainter). InnerHTML = __minisite__weather__;
}
catch (E)
{
}
});
},
Print:function (Conainter)
{
var ok = function ()
{
var province = null;
var city = null;
var ipaddress = MiniSite.Cookie.get ("qq_ipaddress");
if (IPAddress!= null)
{
Try
{
var Ipaddressarr = Ipaddress.split (",");
province = ipaddressarr[0];
City =ipaddressarr[1];
}
catch (E)
{
}
}
Minisite.weather._print (province, city, Conainter);
};
if (! MiniSite.Cookie.get ("qq_ipaddress"))
{
minisite.jsloader.load ("http:// Fw.qq.com:80/ipaddress ", function ()
{
if (typeof ipdata!=" Undefined ")
{
minisite.cookie.set (' qq_ipaddress '), ipdata[2]+ ', ' +ipdata[3]);
ok ();
}
});
}
else
{
ok ();
}
}
};