日期:2014-05-19  浏览次数:20776 次

AxWebBrowser中,Frame中的Frame杂个操作呀?
rt

------解决方案--------------------
//项目中添加Micrsoft.mshtml引用

private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument;
foreach (IHTMLElement vElement in vDocument.all)
if (vElement.tagName.ToUpper() == "FRAME ")
{
IHTMLFrameBase2 vFrameBase2 = vElement as IHTMLFrameBase2;
//TODO : vFrameBase2
}
}

------解决方案--------------------
//项目中添加Micrsoft.mshtml引用

private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument;
foreach (IHTMLElement vElement in vDocument.all)
if (vElement.tagName.ToUpper() == "FRAME ")
{
IHTMLFrameBase2 vFrameBase2 = vElement as IHTMLFrameBase2;
//TODO : vFrameBase2
}
}

哪儿错?
------解决方案--------------------
每个Frame都在一个Frames对像数组中,一个一个慢慢试吧!调整一下f的值就可以了.
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)axWebBrowser1.Document;
object f=1;
mshtml.HTMLWindow2Class w2=(mshtml.HTMLWindow2Class)doc.frames.item(ref f);
mshtml.IHTMLDocument2 doc2 = (mshtml.IHTMLDocument2)w2.document;
textBox1.Text =doc2.body.innerHTML;

------解决方案--------------------
HTMLDocument doc = (HTMLDocument)axWb.Document;
object j;
for (int i = 0; i < doc.parentWindow.frames.length; i++)
{
j = i;
HTMLWindow2Class frame = doc.parentWindow.frames.item(ref j) as HTMLWindow2Class;
MessageBox.Show(frame.name);
}

------解决方案--------------------
这个问题,我也遇到了,只能获取到第1个页面里的FRAME,FRAME里的那个页上的框架,怎么获得呢??
------解决方案--------------------
LZ。我试着找到了,里面那个框架所在的页面,然后在这个页面里,在抓取FRAME,

如果直接从最外层,我就不知道怎么抓了!