Controlling HTML elements in net

Source: Internet
Author: User


Form mshtml. Htmlformelementclass

IHTMLDocument2 mydocument= (IHTMLDocument2) web. Document;
by piece [by Piece]:ihtmlelement element
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;
}
input [Output]:ihtmlinputelement element
Object obj1 = Mydocument.all.item ("username", 0);
if (Obj1 is ihtmlinputelement)
{
((ihtmlinputelement) obj1). Value = "Set user name value";

}
Form Frame:htmlframeelementclass
Object obj1 = Mydocument.all.item ("main", 0);
if (Obj1 is Htmlframeelementclass)
{
obj1= (Htmlframeelementclass) obj1;
}

Opens a new page in the specified box: 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");

}

Gets the specified box and gets the value of the element and the source URL of the frame in the Source and box
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;//element value
Datatext. AppendText (((IHTMLElement) obj2). InnerHTML);//source
Datatext. AppendText (((Htmlframeelementclass) obj1). ContentWindow.location.href);//the Source URL in the box
}
}

This type of framework: 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.