婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > asp下以Json獲取中國天氣網(wǎng)天氣的代碼

asp下以Json獲取中國天氣網(wǎng)天氣的代碼

熱門標(biāo)簽:武漢營銷電話機(jī)器人軟件 騰訊地圖標(biāo)注商戶關(guān)閉 西寧公司外呼系統(tǒng)平臺 智能電銷機(jī)器人適用于哪些行業(yè) 長沙防封電銷卡品牌 地圖標(biāo)注宅基地 地圖標(biāo)注服務(wù)哪家好 徐州人工智能電銷機(jī)器人好用嗎 外呼系統(tǒng)還用卡么
百度了一下,找了點別人的方法改進(jìn)了一下。
獲取天氣網(wǎng)址:http://www.weather.com.cn/html/weather/101210701.shtml這里是溫州的,當(dāng)然其他城市自己搜索一下,換一下ID。
由于是寫入cookies記錄當(dāng)天天氣,所有需要在站點下瀏覽。
js代碼:
復(fù)制代碼 代碼如下:

var Url=escape("http://m.weather.com.cn/data/101210701.html");
var COOKIE_info = "COOKIE_info";
var date = new Date();
var Hours=24-date.getHours()-1;
var Mins=60-date.getMinutes()-1;
var Secs=60-date.getSeconds();
date.setTime(date.getTime() + (1 * Hours * 60 * 60 * 1000) + (1 * 1 * Mins * 60 * 1000) + (1 * 1 * 1 * Secs * 1000));
var RD_cookie_info= $.cookie(COOKIE_info);
$(function(){
if(RD_cookie_info==null)
{
Getdata(Url);
}
else{
$("#weather").html(RD_cookie_info);
}
})

function Getdata(Url)
{
$.ajax({
type:"GET",
cache: "false",
url: "AjaxGet.asp",
data:"Url="+Url,
dataType: "html",
error: function(){$("#weather").html("讀取失敗...請刷新重試!");},
success: function(json){
var t = '('+json+')';
var result = eval(t);
var Getinfo="";
Getinfo+=result.weatherinfo.date_y+"nbsp;";//年月日
Getinfo+=result.weatherinfo.date+"nbsp;";//農(nóng)歷年月日
Getinfo+=result.weatherinfo.week+"nbsp;";//星期幾
Getinfo+="br />";//換行
Getinfo+=result.weatherinfo.city;//獲取城市名稱
Getinfo+="nbsp;img src=\"http://m.weather.com.cn/img/c"+result.weatherinfo.img1+".gif\"/>nbsp;"http://天氣圖片1
Getinfo+="img src=\"http://m.weather.com.cn/img/c"+result.weatherinfo.img2+".gif\"/>nbsp;";//天氣圖片2
Getinfo+=result.weatherinfo.weather1+"nbsp;";//天氣情況
Getinfo+=result.weatherinfo.temp1;//溫度
$.cookie(COOKIE_info,Getinfo, { path: '/', expires: date });
$("#weather").html(Getinfo);
}
});
}


html代碼:
復(fù)制代碼 代碼如下:

div id="weather" style="font-size:12px;">/div>

這個是用網(wǎng)絡(luò)上常見的asp抓取,當(dāng)然也可以換成.net抓取或者其他。附上demo。
您可能感興趣的文章:
  • ASP調(diào)用WebService轉(zhuǎn)化成JSON數(shù)據(jù),附j(luò)son.min.asp
  • asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼
  • asp對復(fù)雜json的解析一定要注意要點
  • ASP JSON類文件的使用方法
  • ASP JSON類源碼分享
  • ASP Json Parser修正版
  • ASP 處理JSON數(shù)據(jù)的實現(xiàn)代碼

標(biāo)簽:通化 雅安 普洱 鷹潭 巴彥淖爾 荊門 通遼 運(yùn)城

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp下以Json獲取中國天氣網(wǎng)天氣的代碼》,本文關(guān)鍵詞  asp,下以,Json,獲取,中國,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp下以Json獲取中國天氣網(wǎng)天氣的代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp下以Json獲取中國天氣網(wǎng)天氣的代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 同江市| 浙江省| 承德县| 彭水| 文山县| 德化县| 南部县| 大竹县| 建瓯市| 葫芦岛市| 普宁市| 乃东县| 襄樊市| 漳州市| 同江市| 奉化市| 全州县| 康定县| 黔西县| 宿州市| 巨野县| 鄄城县| 柘城县| 永州市| 明溪县| 东乡| 贵定县| 胶南市| 汽车| 岳西县| 南开区| 屯昌县| 宜兰县| 厦门市| 蚌埠市| 霍城县| 库车县| 凌云县| 湘潭市| 盱眙县| 三河市|