日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

實(shí)例解析抓取天氣預(yù)報(bào)的程序_ASP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:ASP返回某字符串最后出現(xiàn)的位置
% dwwwStr= divdwww.cn/divdivwww.dwww.cn/div設(shè)計(jì)家園 dwwwStr= InStrRev(dwwwStr,/div) response.write dwwwStr % InstrRev 描述 返回某字符串在另一個(gè)字符串中出現(xiàn)的從結(jié)尾計(jì)起的位置。 語法 InstrRev(string1, string2[, start[, compare]]) InstrRe

早上在公司上班的時(shí)候,看到外邊下起了雪,2008年的第一場(chǎng)雪,比以往來的更晚一點(diǎn),呵呵,冷啊。。

于是想辦法寫抓天氣預(yù)報(bào)的程序,看到了QQ的天氣預(yù)報(bào)挺不錯(cuò)的。。呵呵。。就抓你了!

如圖:

代碼:

<%
'On Error Resume Next
'作者:無情 來源: 轉(zhuǎn)載請(qǐng)保留出處
Response.ContentType="text/html; charset=gb2312"

Call weather()

Sub weather()

url="http://weather.news.qq.com/inc/07_ss252.htm" '上海的天氣

Call IsObjInstalled("Microsoft.XMLHTTP")

weatherStr= getHTTPPage(url)

if weatherStr="" then
response.write "抱歉,天氣預(yù)報(bào)加載失敗!"
else
set reg=new Regexp
reg.Multiline=True
reg.Global=false
reg.IgnoreCase=true
reg.Pattern="<td height=""77"" class=""wht2 lk37"">((.|\n)*?)</td>"

Set matches = reg.execute(weatherStr)
For Each match1 in matches
weatherStr=match1.Value
Next
Set matches = Nothing
Set reg = Nothing

if InStr(weatherStr,"沒有找到與")>0 then
response.write "抱歉,天氣預(yù)報(bào)加載失敗!"
Else
weatherStr=Replace(weatherStr,"<td height=""77"" class=""wht2 lk37"">","")
weatherStr=Replace(weatherStr,"<div class=""txbd"">","")
weatherStr=Replace(weatherStr,"</div>"," ")
weatherStr=Replace(weatherStr,"</td>","")

response.write "上海天氣預(yù)報(bào):"&weatherStr&""

end if

end if

End Sub

'// 采用 Microsoft.XMLHTTP 組件采集數(shù)據(jù)
Function getHTTPPage(url)
'on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
End function

分享:解析Asp實(shí)現(xiàn)Dig程序中的投票
ASP做一個(gè)dig程序中的投票(有的叫頂一下,踩一下),由于代碼較長(zhǎng),只貼出核心部分:投票中的代碼 網(wǎng)頁顯示投票的部分: div class=Vote1script src='/voteResult.asp?id=1action=view'/script/div 效果如圖: 520)this.width=500 border=0>,然后點(diǎn)投一

共2頁上一頁12下一頁
來源:模板無憂//所屬分類:ASP教程/更新時(shí)間:2010-05-29
相關(guān)ASP教程