IHTMLDocument Interface

IHTMLDocument Interface

Used to get information about a document, to examine and modify the HTML elements and text in the document, and to process related events.

IHTMLDocument Members

ScriptGets an interface pointer that provides access to the scripting object via a handle to the script engine.

Remarks

Typically, every window object has a corresponding document object that you get by calling the QueryInterface function with the IID_IHTMLDocument or IID_IHTMLDocument2 interface identifiers. A document object represents the HTML document in a given browser window. Windows that contain HTML documents always have valid document objects; windows that contain documents in other formats might not have valid document objects.

In general, before you attempt to get the document object for a window that is not the current window, make sure that the source file associated with that window is an HTML document file or a file that can be represented as an HTML document—for example, a text file.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesMshtml.h, Mshtml.idl
Minimum availabilityInternet Explorer 4.0
Minimum operating systemsWindows 95, Windows NT 4.0, Windows CE 2.12

 

 

 

IHTMLDocument2 Interface

Gets information about the document, and examines and modifies the HTML elements and text in the document.

IHTMLDocument2 Members

activeElementGets the object that has the focus when the parent document has focus.
alinkColorSets or gets the color of all active links in the document.
allGets an interface pointer to a zero-based collection of all the elements in an HTML document.
anchorsGets an interface pointer to a zero-based collection of all the a objects in an HTML document.
appletsGets an interface pointer to a zero-based collection of all of the applet objects in an HTML document.
bgColorDeprecated. Sets or retrieves a value that indicates the background color behind the object.
bodyGets an interface pointer to the document body object.
charsetSets or retrieves the character set used to encode the object.
clearNot currently supported.
closeCloses an output stream and forces the sent data to display.
cookieSets or gets the string value of a cookie.
createElementCreates an instance of the element for the specified tag.
createStyleSheetCreates a style sheet for the document.
defaultCharsetGets the default character set from the current regional language settings.
designModeSets or gets a value that indicates whether the document can be edited.
domainSets or gets the security domain of the document.
elementFromPointReturns the element for the specified x coordinate and the specified y coordinate.
embedsGets an interface pointer to a zero-based collection of all of the embed objects in an HTML document.
execCommandExecutes a command on the current document, current selection, or the given range.
execCommandShowHelpDisplays help information for the given command identifier.
expandoSets or retrieves a value indicating whether arbitrary variables can be created within the object.
fgColorSets or gets the foreground (text) color of the document.
fileCreatedDateRetrieves the date the file was created.
fileModifiedDateRetrieves the date the file was last modified.
fileSizeRetrieves the file size.
fileUpdatedDateRetrieves the date the file was last updated.
formsGets an interface pointer to a zero-based collection of all the form objects in an HTML document.
framesGets an interface pointer to a zero-based collection of all of the frame objects in an HTML document, if the document contains the frameSet object. Gets an interface pointer to a zero-based collection of all of the iframe objects in the document, if the document contains the body object.
imagesGets a pointer to the IHTMLElementCollection interface of the zero-based collection of all of the images in an HTML document. The images are in the same order as they appear in the document.
lastModifiedGets the date that the page was last modified, if the page supplies one.
linkColorSets or gets the color of the document links.
linksGets an interface pointer to a zero-based collection of all of the link objects and the area objects in an HTML document.
locationRetrieves an interface pointer to a location object.
mimeTypeRetrieves the MIME type for the file.
namePropGets the title of the document file.
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.
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.
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.
onreadystatechangeSets or retrieves a pointer to the event handler function associated with the onreadystatechange 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.
openOpens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the IHTMLDocument2::write method and the IHTMLDocument2::writeln method.
parentWindowGets a reference to the container object of the window.
pluginsGets an interface pointer to a zero-based collection of all of the embed objects in an HTML document.
protocolSets or retrieves the protocol portion of a URL.
queryCommandEnabledReturns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLDocument2::execCommand, given the current state of the document.
queryCommandIndetermReturns a Boolean value that indicates whether the specified command is in the indeterminate state.
queryCommandStateReturns a Boolean value that indicates the current state of the command.
queryCommandSupportedReturns a Boolean value that indicates whether the current command is supported on the current range.
queryCommandTextRetrieves the string associated with a command.
queryCommandValueReturns the current value of the document, range, or current selection for the given command.
readyStateRetrieves a value that indicates the current state of the object.
referrerGets the URL of the location that referred the user to the current page.
scriptsGets an interface pointer to a zero-based collection of all of the script objects in an HTML document.
securityNot implemented.
selectionGets an interface pointer to an object representing the active selection. The active selection can be an insertion point, a highlighted block of text, or another element in the document that the user or a script can carry out an action on.
styleSheetsGets an interface pointer to a zero-based collection of the style sheet objects exposed from the document object. Each style sheet object represents an individual style sheet that is defined for the document.
titleSets or gets the title of the document.
toStringRetrieves a string representation of the object.
URLSets or gets the URL for the current document.
vlinkColorSets or gets the color of the links that the user has visited.
writeWrites one or more HTML expressions to a document in the specified window.
writelnWrites one or more HTML expressions, followed by a carriage return, to a document in the specified window.

Remarks

Typically, every window object has a corresponding document object that you can get by calling the QueryInterface method with the IID_IHTMLDocument or IID_IHTMLDocument2 interface identifiers. Windows that contain HTML documents always have valid document objects; windows that contain documents in other formats might not have valid document objects.

In general, before you attempt to get the document object for a window that is not the current window, make sure that the source file associated with that window is an HTML document file or a file that can be represented as an HTML document, for example, a text file.

This interface may also be referred to in code as IOmDocument2.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesMshtml.h, Mshtml.idl
Minimum availabilityInternet Explorer 4.0
Minimum operating systemsWindows 95, Windows NT 4.0, Windows CE 2.12

 

 

 

IHTMLDocument3 Interface

Provides access to additional properties and methods of the document objects.

IHTMLDocument3 Members

attachEventBinds the specified function to an event, so that the function gets called whenever the event fires on the object.
baseUrlNot currently supported.
childNodesGets the child nodes of the document object.
createDocumentFragmentCreates a new document and returns a pointer to the newly created document.
createTextNodeCreates a text string from the specified value.
detachEventUnbinds the specified function from the event, so that the function stops receiving notifications when the event fires.
dirSets or retrieves a value that indicates the reading order of the object.
documentElementGets a reference to the root node of the document.
enableDownloadNot currently supported.
getElementByIdReturns a reference to the first object with the specified value of the ID or NAME attribute.
getElementsByNameGets a collection of objects based on the value of the NAME or ID attribute.
getElementsByTagNameRetrieves a collection of objects based on the specified element name.
inheritStyleSheetsNot currently supported.
onbeforeeditfocusSets or retrieves a pointer to the event handler function associated with the onbeforeeditfocus event.
oncellchangeSets or retrieves a pointer to the event handler function associated with the oncellchange event.
oncontextmenuSets or retrieves a pointer to the event handler function associated with the oncontextmenu 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.
onpropertychangeSets or retrieves a pointer to the event handler function associated with the onpropertychange 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.
onstopSets or gets a pointer to the event handler function associated with the event.
parentDocumentGets an interface pointer that provides access to the document interface for the parent object.
recalcRecalculates all dynamic properties in the current document.
releaseCaptureRemoves mouse capture from the object in the current document.
uniqueIDRetrieves an autogenerated, unique identifier for the object.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesMshtml.h, Mshtml.idl
Minimum availabilityInternet Explorer 5
Minimum operating systemsWindows 95, Windows NT 4.0, Windows CE 4.0

 

 

 

IHTMLDocument4 Interface

Provides access to additional properties and methods of the document object, which represents the HTML document in a given browser window.

IHTMLDocument4 Members

createDocumentFromUrlCreates a new document object from an existing URL.
createEventObjectGenerates an event object to pass event context information when you use the IHTMLDocument4::fireEvent method.
createRenderStyleCreates an IHTMLRenderStyle interface.
fireEventFires a specified event on the object.
focusCauses the document to receive the focus.
hasFocusGets a value indicating whether the object currently has focus.
mediaNot currently supported.
namespacesGets the collection of all namespace objects associated with the document.
oncontrolselectSets or retrieves a pointer to the event handler function associated with the oncontrolselect event.
onselectionchangeSets or gets a pointer to the event handler function associated with the onselectionchange event.
URLUnencodedGets the URL for the document, stripped of any character encoding.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesmshtml.h, mshtml.idl
Minimum availabilityInternet Explorer 5.5
Minimum operating systemsWindows 95, Windows NT 4.0, Windows CE 4.0

 

 

 

IHTMLDocument5 Interface

Provides access to additional properties and methods of the document object, which represents the HTML document in a given browser window.

IHTMLDocument5 Members

compatModeGets a value that indicates whether standards-compliant mode is switched on for the object.
createAttributeCreates an IHTMLDOMAttribute interface with a specified name.
createCommentCreates an IHTMLCommentElement2 interface with the specified data.
doctypeGets the document type declaration associated with the current document.
implementationGets the implementation object of the current document.
onactivateSets or retrieves a pointer to the event handler function associated with the onactivate event.
onbeforeactivateSets or retrieves a pointer to the event handler function associated with the onbeforeactivate event.
onbeforedeactivateSets or retrieves a pointer to the event handler function associated with the onbeforedeactivate event.
ondeactivateSets or retrieves a pointer to the event handler function associated with the ondeactivate event.
onfocusinSets or retrieves a pointer to the event handler function associated with the onfocusin event.
onfocusoutSets or retrieves a pointer to the event handler function associated with the onfocusout event.
onmousewheelSets or retrieves a pointer to the event handler function associated with the onmousewheel event.

Remarks

IHTMLDocument5 was introduced in Microsoft Internet Explorer 6.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesmshtml.h, mshtml.idl
Minimum availabilityInternet Explorer 6
Minimum operating systemsWindows 98, Windows NT 4.0

See Also

 

 

 

IHTMLDocument6 Interface

 

Extends IHTMLDocument5 with support for document compatibility modes and DOM Storage events.

IHTMLDocument6 Members

compatibleRetrieves the collection of user agents and versions declared in the X-UA-Compatible
documentModeRetrieves the document compatibility mode of the document.
getElementByIdReturns a reference to the first object with the specified ID value.
onstorageSets or retrieves a pointer to the event handler function associated with the DOM Storage event.
onstoragecommitSets or retrieves a pointer to the event handler function associated with the DOM Storage
updateSettingsAllows updating the print settings for the page.

Interface Information

Stock Implementationmshtml.dll
Custom ImplementationNo
Inherits fromIDispatch
Header and IDL filesmshtml.h, mshtml.idl
Minimum availabilityInternet Explorer 8
Minimum operating systemsWindows XP SP2

See Also

Defining Document Compatibility
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值