.jpg)
原本想用Javascript處理的= =
我想存取網頁裡面<iframe>裡面的資料...
結果好麻煩阿= ="
後來用C#發現整個變得超輕鬆~
C#真的好棒啊!!!!.jpg)
整理一下用法~
1.
首先是讀取iframe裡面的html原始碼
.jpg)
整理一下用法~
1.
首先是讀取iframe裡面的html原始碼
MessageBox.Show(webBrowser1.Document.Window.Frames[0].Document.Body.InnerHtml);
2.
iframe裡面被按到的連結
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string url = webBrowser1.Document.Window.Frames["main"].Document.ActiveElement.GetAttribute("src"); }
3.
iframe裡面某個id物件
//webBrowser1.Document.Window.Frames[0].Document.All["id"];然後可以對屬性做存取的動作
string title = webBrowser1.Document.Window.Frames[0].Document.All["id"].GetAttribute("title"); webBrowser1.Document.Window.Frames[0].Document.All["id"].SetAttribute("title","ABCDEFG");
.jpg)
沒有留言:
張貼留言