IHTMLElement2 interface

Provides methods to access the properties and methods that are common to all element objects.

Members

The IHTMLElement2 interface inherits from the IDispatch interface. IHTMLElement2 also has these types of members:

  • Methods
  • Properties

Methods

The IHTMLElement2 interface has these methods.

Method Description
addBehavior

Attaches a behavior to the element.

applyElement

Makes the element either a child or parent of another element.

attachEvent
Note   IHTMLElement2::attachEvent is no longer supported. Starting with IE11, use IEventTarget::addEventListener. For info, see Compatibility changes.
 

Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

blur

Causes the element to lose focus and fires the HTMLFrameSiteEvents::onblur event.

clearAttributes

Removes all attributes and values from the object.

componentFromPoint

Returns the component located at the specified coordinates via certain events.

createControlRange

Creates a controlRange collection of nontext elements.

detachEvent

Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

doScroll
Note   IHTMLElement2::doScroll is no longer supported. Starting with IE11, use IHTMLElement2::scrollLeft or IHTMLElement2::scrollTop. For info, see Compatibility changes.
 

Simulates a click on a scroll bar component.

focus

Causes the element to receive the focus and executes the code specified by the HTMLFrameSiteEvents::onfocus event.

getAdjacentText

Returns the adjacent text string.

getBoundingClientRect

Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

getClientRects

Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

getElementsByTagName

Retrieves a collection of objects based on the specified element name.

getExpression

This element is obsolete and should no longer be used. Retrieves the expression for the given property.

insertAdjacentElement

Inserts an element at the specified location.

mergeAttributes

Copies all read/write attributes to the specified element.

releaseCapture

Removes mouse capture from the object in the current document.

removeBehavior

Detaches a behavior from the element.

removeExpression

This element is obsolete and should no longer be used. Removes the expression from the specified property.

replaceAdjacentText

Replaces the text adjacent to the element.

setCapture

Sets the mouse capture to the object that belongs to the current document.

setExpression

This element is obsolete and should no longer be used. Sets an expression for the specified object.

 

Properties

The IHTMLElement2 interface has these properties.

Property Description

accessKey

Sets or retrieves the access key for the object.

canHaveChildren

Gets a value indicating whether the object can contain child objects.

clientHeight

Retrieves the height of the object including padding, but not including margin, border, or scroll bar.

clientLeft

Retrieves the distance between the IHTMLElement::offsetLeft property and the true left side of the client area.

clientTop

Retrieves the distance between the IHTMLElement::offsetTop property and the true top of the client area.

clientWidth

Retrieves the width of the object including padding, but not including margin, border, or scroll bar.

currentStyle

Gets a reference to the currentStyle object, which represents the current cascaded format and style specified by global style sheets, inline styles, and HTML attributes.

dir

Sets or retrieves the reading order of the object.

onbeforecopy

Sets or gets a pointer to the event handler function associated with the event.

onbeforecut

Sets or gets a pointer to the event handler function associated with the event.

onbeforeeditfocus

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onbeforeeditfocus event.

onbeforepaste

Sets or gets a pointer to the event handler function associated with the event.

onblur

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onblur event.

oncellchange

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::oncellchange event.

oncontextmenu

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::oncontextmenu event.

oncopy

Sets or gets a pointer to the event handler function associated with the event.

oncut

Sets or gets a pointer to the event handler function associated with the event.

ondrag

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondrag event.

ondragend

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragend event.

ondragenter

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragenter event.

ondragleave

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragleave event.

ondragover

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragover event.

ondrop

Sets or gets a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondrop event.

onfocus

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onfocus event.

onlosecapture

Sets or gets a pointer to the event handler function associated with the event.

onpaste

Sets or gets a pointer to the event handler function associated with the event.

onpropertychange

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onpropertychange event.

onresize

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onresize event.

onrowsdelete

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowsdelete event.

onrowsinserted

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowsinserted event.

onscroll

Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onscroll event.

readyState

Retrieves the current state of the object.

runtimeStyle

Gets the element's runtimeStyle object.

scopeName

Gets the namespace defined for the element.

This property is not supported for Windows apps using JavaScript.

scrollHeight

Retrieves the scrolling height of the object.

scrollLeft

Sets or retrieves the distance between the left edge of the object and the leftmost portion of the content currently visible in the window.

scrollTop

Sets or retrieves the distance between the top of the object and the topmost portion of the content currently visible in the window.

scrollWidth

Retrieves the scrolling width of the object.

tabIndex

Sets or retrieves the index that defines the tab order for the object.

tagUrn

Sets or gets the URN specified in the namespace declaration.

This property is not supported for Windows apps using JavaScript.

 

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch