利用ResponseXML的方法調(diào)用163天氣預(yù)報(bào)
網(wǎng)絡(luò) 2009/1/23 9:46:38 深山行者 字體:
大 中 小 瀏覽 14419
|
以下是引用片段:
<!-- 以下是抓取的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)閱讀
- asp導(dǎo)出內(nèi)容到excel表并自定義命名后下載(非打開(kāi))
- 網(wǎng)站需要SEO,基本的SEO建站要點(diǎn)
- 深山留言板v4.8 - 5.13母親節(jié)模板
- Photoshop中精典實(shí)用技巧
- 純div+css制作的彈出菜單-02
- 07 問(wèn)題錯(cuò)誤整理 程序目錄權(quán)限 父路徑?jīng)]打開(kāi)錯(cuò)誤
- uniapp的rich-text組件注入的a標(biāo)簽點(diǎn)擊跳轉(zhuǎn)處理
- 調(diào)整CSS類型的順序改變鏈接翻滾效果
- 共有0條關(guān)于《利用ResponseXML的方法調(diào)用163天氣預(yù)報(bào)》的評(píng)論
- 發(fā)表評(píng)論