| 发表于:2008-01-23 15:10:455楼 得分:0 |
//执行 private sub command1_click() if combo2.text = "" then msgbox "请选择城市!", vbokonly + 64, "提示" else strhtml = "" tital.caption = combo2.text & "天气" staflag = 0 call webbrowser1.navigate("http://php.weather.sina.com.cn/search.php?city=" & combo2.text) label1.caption = "请 稍 后 ..." end if end sub //处理数据 private sub webbrowser1_downloadcomplete() dim i as long dim j as long dim k as long dim inttemp as integer on error resume next if len(strhtml) = 0 then 'get data strhtml = webbrowser1.document.documentelement.innerhtml if len(strhtml) <> 0 then for j = 0 to 2 i = instr(strhtml, " <div class=city_data> ") strhtml = mid$(strhtml, i) weatherday(j).stradd = getdata(" <h3> ", " </h3> ", strhtml) weatherday(j).strdate = getdata(" <p> ", " </p> ", strhtml) weatherday(j).strpicpath = getdata("src=" & chr$(34), chr$(34) & "> </div> ", strhtml) weatherday(j).strweather = getdata("weather_tp> ", " </div> ", strhtml) weatherday(j).strwind = getdata("weather_w> ", " </div> ", strhtml) i = instr(strhtml, " <div class=weather_sm") strhtml = mid$(strhtml, i) inttemp = iif(j = 0, 9, 5) for k = 0 to inttemp weatherday(j).strsm(k) = getdata(" <p> ", " </p> ", strhtml) next next 'display data call displaydata(staflag) label1.caption = "下载完成 " end if end if exit sub err1: end sub | | |
|