利用ResponseXML的方法調(diào)用163天氣預(yù)報(bào)
網(wǎng)絡(luò) 2009/1/23 9:46:38 深山行者 字體:
大 中 小 瀏覽 14128
以下是引用片段:
<!-- 以下是抓取的XML源,http://www.163.com/weatherxml/58044.xml
<?xml version="1.0" encoding="GBK"?> <root> <weather c="連云港" city="58044" qx="陰轉(zhuǎn)晴" wd="-7℃~-2℃" fl="6~7級(jí)" qximg="02.gif,00.gif" lk="1級(jí) 干燥 晴天,雖然天氣有點(diǎn)涼,但其它條件適宜,路面比較干燥,路況較好。 "/> </root> --> <% url = "http://www.163.com/weatherxml/58044.xml" ' 58044 是連云港相對(duì)應(yīng)的天氣預(yù)報(bào)碼 Set http=Server.CreateObject("Microsoft.XMLHTTP") http.Open "GET",url,False http.send Set xml=Server.CreateObject("Microsoft.XMLDOM") xml.Async=true xml.ValidateOnParse=False xml.Load(http.ResponseXML) If xml.ReadyState>2 Then Response.Write("文檔已經(jīng)準(zhǔn)備就緒。狀態(tài):"& xml.ReadyState &"<br>") '這句可不加 set res = xml.selectSingleNode("http://weather") Response.Write res.getAttribute("c") Response.Write " " Response.Write res.getAttribute("wd") Response.Write " " Response.Write res.getAttribute("qx") Response.Write " " Response.Write res.getAttribute("fl") Response.Write " " tqimg = split(res.getAttribute("qximg"),",") '以下為顯示天氣小圖標(biāo) if tqimg(0) <> "" then Response.Write "<img src='http://news.163.com/img/logo/"& tqimg(0) &"'>" elseif tqimg(1) <> "" then Response.Write "<img src='http://news.163.com/img/logo/"& tqimg(1) &"'>" else response.Write "" end if Response.Write "<br>" End if
Set oNode = Nothing Set oDoc = Nothing %>
|
- 相關(guān)閱讀
- CSS中的行為——expression的研究
- 兼容pc、移動(dòng)端用js實(shí)現(xiàn)復(fù)制內(nèi)容到剪切板(支持蘋(píng)果safari瀏覽器)
- 張掖春秋國(guó)際旅行社有限公司
- canvas繪制的文字如何換行
- ASP.NET中文亂碼問(wèn)題的解決。
- IE中奇怪的左右border斷線(xiàn)現(xiàn)象
- CSS常用網(wǎng)站布局實(shí)例
- CSS設(shè)計(jì)中常見(jiàn)的精華問(wèn)題收集
- 共有0條關(guān)于《利用ResponseXML的方法調(diào)用163天氣預(yù)報(bào)》的評(píng)論
- 發(fā)表評(píng)論