Classic ASP と XML を使用して世界の天気をオンラインで使用して天気ウィジェットを実装しましたが、すべて正常に動作しているように見えますが、アイコンを変更する方法を誰かが知っているかどうか知りたいですか?
ありがとう
<%
Function getweather(city)
Dim tempC, wDesc, wIcon, currentWeather
Dim wDate, wHigh, wLow, extWeather
url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" & city & ",Canada&format=xml&num_of_days=4&key=********"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
set objXML = Server.CreateObject("MSXML2.DOMDocument")
objXML.async = false
objXML.loadxml xmlhttp.responseText
set x = objXML.getElementsByTagName("current_condition")
if x.length = 0 then
retStr = "Error"
else
for i = 0 to x.item(0).childNodes.length - 1
if x.item(0).childNodes(i).nodeName = "temp_C" then
tempC = x.item(0).childNodes(i).text & "°C"
end if
if x.item(0).childNodes(i).nodeName = "weatherDesc" then
wDesc = x.item(0).childNodes(i).text
end if
if x.item(0).childNodes(i).nodeName = "weatherIconUrl" then
wIcon = "<img class='wIcon' src=" & x.item(0).childNodes(i).text & " height=45 width=45>"
end if
next
currentWeather = "<div id='curWeather'><span class='city'>" & city & "</span>" & wIcon & "<div class='tempC'>" & tempC & "<br />" & wDesc & "</div>" & "<a href='#' class='clrWeather' title='Clear weather information'><img src='images/clrweather.gif' alt='Clear weather information' /></a><div style='clear: both;'> </div></div>"
'Extended weather
extWeather = "<div class='extWeather'>"
set y = objXML.getElementsByTagName("weather")
for i = 0 to y.length - 1
for j = 0 to y.item(i).childNodes.length - 1
select case y.item(i).childNodes(j).nodeName
Case "date"
wDate = y.item(i).childNodes(j).text
wDate = "<div class='ewDate'>" & WeekdayName(Weekday(wDate), true) & "</div>"
Case "weatherDesc"
wDesc = "<div class='ewDesc'>" & y.item(i).childNodes(j).text & "</div>"
Case "weatherIconUrl"
wIcon = "<img class='ewIcon' src=" & y.item(i).childNodes(j).text & " height=20 width=20>"
Case "tempMaxC"
wHigh = y.item(i).childNodes(j).text & "°"
Case "tempMinC"
wLow = y.item(i).childNodes(j).text & "°"
end select
next
extWeather = extWeather & "<div class='extCol'>" & wDate & wIcon & "<div class='wHigh'>" & wHigh & " / " & wLow & "</div>" & wDesc & "</div>"
next
extWeather = extWeather & "<div style='clear: both;'></div></div>"
retStr = currentWeather & extWeather
end if
set objXML = nothing
set xmlhttp = nothing
getweather = retStr
End function
Function getCities
getCities = "<option value=-1>Select city for weather info</option>" & _
"<optgroup label='ONTARIO'><option value='BARRIE'>BARRIE</option>" & _
"<option value='BRAMPTON'>BRAMPTON</option>" & _
"<option value='CAMBRIDGE'>CAMBRIDGE</option><option value='HAMILTON'>HAMILTON</option><option value='KINGSTON'>KINGSTON</option><option value='LONDON'>LONDON</option><option value='ORILLIA'>ORILLIA</option><option value='OTTAWA'>OTTAWA</option><option value='OWEN SOUND'>OWEN SOUND</option><option value='PETERBOROUGH'>PETERBOROUGH</option><option value='SOUTH PORCUPINE'>SOUTH PORCUPINE</option><option value='SAINT CATHARINES'>ST. CATHARINES</option><option value='SUDBURY'>SUDBURY</option><option value='THUNDER BAY'>THUNDER BAY</option><option value='TIMMINS'>TIMMINS</option><option value='WINDSOR'>WINDSOR</option><optgroup label='NEWFOUNDLAND & LABRADOR'><option value='CORNER BROOK'>CORNER BROOK</option>"
End Function
%>