浏览主站 | 站长合租 | 新闻资讯 | 站长学院 | 站长盈利 | HTML教程 | 网址导航 | 站长周刊 | 会员投稿 | 滚动新闻 | RSS
发新话题
打印

[代码问题] 求人帮忙换个天气预报

求人帮忙换个天气预报

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>天气预报</TITLE>
</HEAD>
<%@ Language=VBScript %>
<%
'获取远程文件
Function GetURL(url)
    Set Retrieval = CreateObject("Microsoft.XMLHTTP")
    With Retrieval
        .Open "GET", url, False
        .Send
        GetURL = .responsebody
  GetURL = Bytes2BStr(GetURL)
if len(.responsebody)<100 then
  response.write "Error: Get URL"
  response.end
end if
    End With
    Set Retrieval = Nothing
End Function
'二进制转换
Function bytes2bstr(vin)
strreturn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
  strreturn = strreturn & chr(thischarcode)
else
  nextcharcode = ascb(midb(vin,i+1,1))
  strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
  i = i + 1
end if
next
bytes2bstr = strreturn
End Function
'取得特定文字之间的文字
Function GetBetween(Text0, Text1, Text2)
tmp_pos_1 = Instr(Text0, Text1)
tmp_pos_2 = Instr(Text0, Text2)
GetBetween = Mid(Text0, tmp_pos_1 + len(Text1), tmp_pos_2 - tmp_pos_1 - len(Text1))
End Function
function city(code)
<!-- 以下是163无余天气代码路径,请查询好你本地路径之后把这里替换即可--!>
Html=GetURL("http://news.163.com/weather/news/qx1/58367.html")
'xxxx01 = GetBetween ( Html, "this.swCity = """,  "this.swSubDiv")
'xxxx01 = GetBetween ( Html, "this.swCity = """,  "this.swSubDiv")
'xxxx02 = GetBetween ( Html, "this.swTemp = """,  "this.swTempCel")
'xxxx03  = GetBetween ( Html, "this.swCIcon = """, "this.swWindS")
'xxxx04 = GetBetween ( Html, "this.swWindS = """, "this.swWindD")
'xxxx05 = GetBetween ( Html, "this.swBaro = """,  "this.swHumid")
'xxxx06 = GetBetween ( Html, "this.swHumid = """, "this.swReal")
'xxxx07 = GetBetween ( Html, "this.swReal = """,  "this.swUV")
'xxxx08 = GetBetween ( Html, "this.swUV = """,    "this.swVis")
'xxxx09 = GetBetween ( Html, "this.swVis = """,   "this.swLastUp")
'xxxx10 = GetBetween ( Html, "this.swC",   "this.swFore")
'xxxx01 = left(xxxx01, len(xxxx01) - 7)
'xxxx02 = Round(((5/9)*( CDbl(left(xxxx02, len(xxxx02) - 7)) -32)))
'xxxx03 = "weather_icon/" + left(xxxx03, len(xxxx03) - 7) + ".gif"
'xxxx04 = Round(CDbl(left(xxxx04, len(xxxx04) - 7)) * 1.609334, 2)
'xxxx05 = Round(CDbl(left(xxxx05, len(xxxx05) - 7)) * 3.386389, 2)
'xxxx06 = CDbl(left(xxxx06, len(xxxx06) - 7))
'xxxx07 = Round(((5/9)*(CDbl(left(xxxx07, len(xxxx07) - 7)) -32)))
'xxxx08 = CDbl(left(xxxx08, len(xxxx08) - 7))
'xxxx09 = Round(CDbl(left(xxxx09, len(xxxx09) - 7)) * 1.609334)
'xxxx10 = left(xxxx10, len(xxxx10) - 7)
'Response.write "<font size='1px'><b>"&xxxx01&"</b><br>"
'Response.write "<img src="""&xxxx03&""">"
'Response.write "["&xxxx10&"]<br>"
'Response.write "露点温度:"&xxxx02&"℃<BR>"
'Response.write "感觉温度:"&xxxx07&"℃<BR>"
'Response.write "紫外线强度:"&xxxx08&"<br>"
'Response.write "湿度:"&xxxx06&" %<br>"
'Response.write "风速:"&xxxx04&" 千米/小时<br>"
'Response.write "能见度:"&xxxx09&" 千米<br>"
'Response.write "气压:"&xxxx05 & "千帕<br></font>"
%>
<style>body, p {font-size:12px}</style>
<%=formatdatetime(now(),1)%><%
html=getbetween(html,"天气预报</span></a>","</div>")
Response.write Html
end function
%>

<%call city("CHXX0010")%><body>
我想把这个上海的天气预报 换成山东淄博的天气预报,可是我在163上一直没找到这个页面。求人帮忙给找一下!
就是这个http://news.163.com/weather/news/qx1/58367.html")

TOP

http://weather.news.163.com/info/54830-1.html

这个是淄博的 天气 不过你的代码不全 我没办法测试啊。

TOP

发新话题