日期:2014-05-17 浏览次数:20414 次
private void Form1_Load(object sender, EventArgs e)
{
string url = "http://www.weather.com.cn/data/cityinfo/101200101.html";
webBrowser1.Navigate(url);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//避免webbroswer.DocumentCompleted被多次引发
if ((e.Url != webBrowser1.Url)
------其他解决方案--------------------
看看介个
------其他解决方案--------------------
楼主可以调用WEBSERIVE 返回的是XML用JQUERY很好遍历。JSON倒没见过
------其他解决方案--------------------
这不就是最简单的JSON吗?
------其他解决方案--------------------
(webBrowser1.ReadyState != WebBrowserReadyState.Complete))
return;
//下面写你要在页面加载完毕后执行的代码。
string result = webBrowser1.Document.Body.InnerText;
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(weatherinfoClass));
weatherinfoClass info = null;
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(result)))
{
info = serializer.ReadObject(ms) as weatherinfoClass;
}
[DataContract]
class weatherinfoClass
{
[DataMember]
public weatherinfo weatherinfo { get; set; }
}
[DataContract]
class weatherinfo
{
[DataMember]