IHTMLElement and IHTMLElement2 are two interfaces for document elements in the same series of IE browser (WebBrowser control, trident kernel. Both interfaces provide a way to programmatically access the attributes and methods of common element objects. I. Next I will introduce the IHTMLElement interface. The IHTMLElement Interface contains many variables and
IHTMLElement and IHTMLElement2 are two interfaces for document elements in the same series of IE browser (WebBrowser control, trident kernel. Both interfaces provide a way to programmatically access the attributes and methods of common element objects. I. Next I will introduce the IHTMLElement interface. The IHTMLElement Interface contains many variables and
IHTMLElement and IHTMLElement2 are two interfaces for document elements in the same series of IE browser (WebBrowser control, trident kernel. Both interfaces provide a way to programmatically access the attributes and methods of common element objects.
I,Next we will introduce the IHTMLElement interface first..
There are many variables and functions in the IHTMLElement interface. Most of the variables are attributes of document elements, for example, class, id, attribute, lang, tagName, InnerText, InnerHtml, OuterText, OuterHtml, child, parentElement, and others are style attributes, such as offsetHeight, offsetLeft, and style, in addition, there are some action attributes of this element, such as onclick, ondragstart, onmousedown, and onmousemove. Besides these member attributes, there are also Member methods, such as click (), getAttribute (..), another part of the member method is the member function (getXX, setXX) arranged for each member variable, such as the id attribute, HRESULT get_id (BSTR * p), HRESULT put_id (BSTR * p ), for the onmousedown member attribute, the corresponding member functions are HRESULT get_onmousedown (VARIANT * p), HRESULT put_onmousedown (VARIANT * p), where VARIANT is of the VT_IDISPATCH type, and its IDispatch interface is refined.
AllRetrieves the collection of all the objects in the HTML that are within the scope of this object.
ChildrenRetrieves the collection that contains all the immediate children of this object.
ClassNameSets or retrieves the class of the object.
ClickSimulates a click by causing the onclick event to fire.
ContainsChecks whether the given element is contained within the object.
DocumentGets the document object for the document that the browser is displaying.
FiltersRetrieves a collection of filters for an element.
GetAttributeRetrieves the value of the specified attribute.
IdSets or retrieves the string identifying the object.
InnerHTMLGets or sets the HTML between the start and end tags of the object.
InnerTextSets or retrieves the text between the start and end tags of the object.
InsertAdjacentHTMLInserts the given HTML text into the element at the location.
InsertAdjacentTextInserts the given text into the element at the specified location.
IsTextEditRetrieves whether a TextRange object can be created using the object.
LangSets or retrieves the language to use.
LanguageSets or retrieves the language in which the current script is written.
OffsetHeightRetrieves the height of the object relative to the layout or coordinate parent, as specified by the IHTMLElement: offsetParent property.
OffsetLeftRetrieves the calculated left position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement: offsetParent property.
OffsetParentRetrieves a reference to the container object that defines the IHTMLElement: offsetTop and IHTMLElement: offsetLeft properties of the object.
OffsetTopRetrieves the calculated top position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement: offsetParent property.
OffsetWidthRetrieves the width of the object relative to the layout or coordinate parent, as specified by the IHTMLElement: offsetParent property.
OnafterUpdateSets or retrieves a pointer to the event handler function associated with the onafterupdate event.
OnbeforeupdateSets or retrieves a pointer to the event handler function associated with the onbeforeupdate event.
OnclickSets or retrieves a pointer to the event handler function associated with the onclick event.
OndataavailableSets or retrieves a pointer to the event handler function associated with the ondataavailable event.
OndatasetchangedSets or retrieves a pointer to the event handler function associated with the ondatasetchanged event.
OndatasetcompleteSets or retrieves a pointer to the event handler function associated with the ondatasetcomplete event.
OndblclickSets or retrieves a pointer to the event handler function associated with the ondblclick event.
OndragstartSets or retrieves a pointer to the event handler function associated with the ondragstart event.
OnerrorupdateSets or retrieves a pointer to the event handler function associated with the onerrorupdate event.
OnfilterchangeSets or retrieves a pointer to the event handler function associated with the event.
OnhelpSets or retrieves a pointer to the event handler function associated with the onhelp event.
OnkeydownSets or retrieves a pointer to the event handler function associated with the onkeydown event.
OnkeypressSets or retrieves a pointer to the event handler function associated with the onkeypress event.
OnkeyupSets or retrieves a pointer to the event handler function associated with the onkeyup event.
OnmousedownSets or retrieves a pointer to the event handler function associated with the onmousedown event.
OnmousemoveSets or retrieves a pointer to the event handler function associated with the onmousemove event.
OnmouseoutSets or retrieves a pointer to the event handler function associated with the onmouseout event.
OnmouseoverSets or retrieves a pointer to the event handler function associated with the onmouseover event.
OnmouseupSets or retrieves a pointer to the event handler function associated with the onmouseup event.
OnrowenterSets or retrieves a pointer to the event handler function associated with the onrowenter event.
OnrowexitSets or retrieves a pointer to the event handler function associated with the onrowexit event.
OnselectstartSets or retrieves a pointer to the event handler function associated with the onselectstart event.
OuterHTMLSets or retrieves the object and its content in HTML.
OuterTextSets or retrieves the text of the object.
ParentElementRetrieves the parent object in the object hierarchy.
ParentTextEditRetrieves the container object in the document hierarchy that can be used to create a TextRange containing the original object.
RecordNumberRetrieves the ordinal record from the data set that generated the object.
RemoveAttributeRemoves an attribute from an object.
ScrollIntoViewCauses the object to scroll into view, aligning it either at the top or bottom of the window.
SetAttributeSets the value of the specified attribute.
SourceIndexRetrieves the ordinal position of the object, in source order, as the object appears in the document's all collection.
StyleRetrieves an inline style sheet for the tag.
TagNameRetrieves the tag name of the object.
TitleSets or retrieves advisory information (a ToolTip) for the object.
ToStringRetrieves a string representation of the object.
Ii. IHTMLElement2 interface Introduction
IHTMLElement2 adds member attributes and methods to the IHTMLElement interface to meet browser upgrade requirements. Attributes added to it, such as readyState, readyStateValue, currentStyle, attributes related to scroll (slide), capture, expression, behavior, and their settings and deletion.
OnpropertychangeSets or retrieves a pointer to the event handler function associated with the onpropertychange event.
OnreadystatechangeSets or retrieves a pointer to the event handler function associated with the onreadystatechange event.
OnresizeSets or retrieves a pointer to the event handler function associated with the onresize event.
OnrowsdeleteSets or retrieves a pointer to the event handler function associated with the onrowsdelete event.
OnrowsinsertedSets or retrieves a pointer to the event handler function associated with the onrowsinserted event.
OnscrollSets or retrieves a pointer to the event handler function associated with the onscroll event.
ReadyStateRetrieves the current state of the object.
ReadyStateValueGets the current state of the object.
ReleaseCaptureRemoves mouse capture from the object in the current document.
RemoveBehaviorDetaches a behavior from the element.
RemoveExpressionRemoves the expression from the specified property.
RemoveFilterNot implemented.
ReplaceAdjacentTextReplaces the text adjacent to the element.
RuntimeStyleGets the element's runtimeStyle object.
ScopeNameGets the namespace defined for the element.
ScrollHeightRetrieves the scrolling height of the object.
ScrollLeftSets or retrieves the distance between the left edge of the object and the leftmost portion of the content currently visible in the window.
ScrollTopSets or retrieves the distance between the top of the object and the topmost portion of the content currently visible in the window.
ScrollWidthRetrieves the scrolling width of the object.
SetCaptureSets the mouse capture to the object that belongs to the current document.
SetExpressionSets an expression for the specified object.
TabIndexSets or retrieves the index that defines the tab order for the object.
TagUrnSets or gets the URN specified in the namespace declaration.
CanHaveChildrenGets a value indicating whether the object can contain in child objects.
The following describes the IHTMLElement2 interface version and other issues. Note that the IHTMLElement interface only requires IE4 and later versions.
Interface Information
Stock Implementation mshtml. dll
Custom Implementation No
Inherits from IDispatch
Header and IDL files Mshtml. h, Mshtml. idl
Minimum availability Internet assumer5
Minimum operating systems Windows 95, Windows NT 4.0, Windows CE 4.0