共用方式為


IHTMLElement interface

This interface provides the ability to programmatically access the properties and methods that are common to all element objects.

Members

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

  • Methods
  • Properties

Methods

The IHTMLElement interface has these methods.

Method Description
click

Simulates a click by causing the HTMLFrameSiteEvents::onclick event to fire.

contains

Checks whether the given element is contained within the object.

getAttribute

Retrieves the value of the specified attribute.

insertAdjacentHTML

Inserts the given HTML text into the element at the location.

insertAdjacentText

Inserts the given text into the element at the specified location.

removeAttribute

Removes an attribute from an object.

scrollIntoView

Causes the object to scroll into view, aligning it either at the top or bottom of the window.

setAttribute

Sets the value of the specified attribute.

 

Properties

The IHTMLElement interface has these properties.

Property Description

className

Sets or retrieves the class of the object.

id

Sets or retrieves the string identifying the object.

innerHTML

Sets or retrieves the HTML between the start and end tags of the object.

innerText

Sets or retrieves the text between the start and end tags of the object.

isTextEdit

Retrieves whether a TextRange object can be created using the object.

lang

Sets or retrieves the language to use.

language

Sets or retrieves the language in which the current script is written.

Note  This has been superceded by the type attribute for the script element. If you are using javascript alone, you don't need to specify a type or language with the script element.
 

offsetHeight

Retrieves the height of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetLeft

Retrieves the calculated left position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetParent

Retrieves a reference to the container object that defines the IHTMLElement::offsetTop and IHTMLElement::offsetLeft properties of the object.

offsetTop

Retrieves the calculated top position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetWidth

Retrieves the width of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

outerHTML

Sets or retrieves the object and its content in HTML.

outerText

Sets or retrieves the text of the object.

parentElement

Retrieves the parent object in the object hierarchy.

parentTextEdit

Retrieves the container object in the document hierarchy that can be used to create a TextRange containing the original object.

recordNumber

Retrieves the ordinal record from the data set that generated the object.

sourceIndex

Retrieves the ordinal position of the object, in source order, as the object appears in the document's all collection.

tagName

Retrieves the tag name of the object.

title

Sets or retrieves advisory information (a ToolTip) for the object.

 

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch