Recommended: ASP returns the last location of a string % dwwwStr= divdwww.cn/divdivwww.dwww.cn/div Design Home dwwwStr= InStrRev(dwwwStr,/div) response.write dwwwStr % InstrRev Description Returns the position from the end of a string that appears in another string . Syntax InstrRev(string1, string2[, start[, compare]]) InstrRe
When I was working in the company in the morning, I saw snow falling outside. The first snow in 2008 was a little later than before. Haha, it was cold. .
So I found a way to write a procedure for weather forecasting, and I saw that the weather forecast on QQ was quite good. . hehe. . I'll catch you!
As shown in the picture:
Code:
<%
'On Error Resume Next
'Author: Wuqing Source: Please keep the source when reprinting
Response.ContentType=text/html; charset=gb2312
Call weather()
Sub weather()
url=http://weather.news.qq.com/inc/07_ss252.htm 'Weather in Shanghai
Call IsObjInstalled(Microsoft.XMLHTTP)
weatherStr= getHTTPPage(url)
if weatherStr= then
response.write Sorry, the weather forecast failed to load!
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, not found with)>0 then
response.write Sorry, the weather forecast failed to load!
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 Shanghai weather forecast: &weatherStr&
end if
end if
End Sub
'// Use Microsoft.XMLHTTP component to collect data
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
Share: Analyze the voting in the Asp implementation Dig program ASP makes a vote in a dig program (some are called top and step on). Because the code is long, only the core part is posted: the code page in the voting displays the vote part: div class=Vote1script src='/voteResult. asp?id=1action=view'/script/div The effect is shown in the figure: 520)this.width=500 border=0>, and then click to cast one
2 pages in total Previous page 12 Next page