【www.gdgbn.com--安卓教程】


Form  mshtml.HTMLFormElementClass

IHTMLDocument2 mydocument=(IHTMLDocument2)web.Document;
按件[按件]:IHTMLElement元素
object obj1 = mydocument.all.item("UG", 0);
if (obj1 is IHTMLElement)
{
 ((IHTMLElement) obj1).click();
}
object obj1 = mydocument.all.item("BetList", 0);
if (obj1 is IHTMLElement)
{
 datatext.Text=((IHTMLElement) obj1).innerText;
}
输入[输出入件]:IHTMLInputElement元素
object obj1 = mydocument.all.item("username", 0);
if (obj1 is IHTMLInputElement)
{
 ((IHTMLInputElement) obj1).value ="设置用户名值";

}
窗体frame:HTMLFrameElementClass
object obj1 = mydocument.all.item("main",0);
if (obj1 is HTMLFrameElementClass)
{
 obj1=(HTMLFrameElementClass) obj1;
}

在指定的框中打开新页:frame
object obj1 = mydocument.all.item("main",0);
if (obj1 is HTMLFrameElementClass)
{
 ((HTMLFrameElementClass) obj1).contentWindow.window.execScript("document.location=""http://"+host+"/en-lang/underover/main.asp?t=l"";","javascript");

}

获取指定的框并获取指的元素值及源码和框中frame的源网址
object obj1 = mydocument.all.item("main",0);
if (obj1 is HTMLFrameElementClass)
{
 object obj2 = ((HTMLFrameElementClass) obj1).contentWindow.document.all.item("BetList", 0);
 if (obj2 is IHTMLElement)
 {
  datatext.Text=((IHTMLElement) obj2).innerText;//元素值
  datatext.AppendText(((IHTMLElement) obj2).innerHTML);//源码
  datatext.AppendText(((HTMLFrameElementClass) obj1).contentWindow.location.href);//框中的源网址
 }
}

这类框架:iframe
HTMLIFrameClass
object obj2 = ((HTMLFrameElementClass) obj1).contentWindow.document.all.item("maintt", 0);
object obj3 = ((mshtml.HTMLIFrameClass) obj2).contentWindow.document.all.item("BetList", 0);
if (obj3 is IHTMLElement)
{
 datatext.Text=((IHTMLElement) obj3).innerText;
 //datatext.AppendText(((IHTMLElement) obj2).innerHTML);
 datatext.AppendText(urlstr);
}

document.formname.action=parent.yourpage;

本文来源:http://www.gdgbn.com/shoujikaifa/14429/