IHTMLDocument2 interface
Gets information about the document, and examines and modifies the HTML elements and text in the document.
Members
The IHTMLDocument2 interface inherits from the IDispatch interface. IHTMLDocument2 also has these types of members:
- Methods
- Properties
Methods
The IHTMLDocument2 interface has these methods.
Method | Description |
---|---|
IHTMLControlRange::execCommand | Executes a command on the current document, current selection, or the given range. |
IHTMLControlRange::execCommandShowHelp | Displays help information for the given command identifier. |
IHTMLControlRange::queryCommandEnabled | Returns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLControlRange::execCommand, given the current state of the document. |
IHTMLControlRange::queryCommandIndeterm | Returns a Boolean value that indicates whether the specified command is in the indeterminate state. |
IHTMLControlRange::queryCommandState | Returns a Boolean value that indicates the current state of the command. |
IHTMLControlRange::queryCommandSupported | Returns a Boolean value that indicates whether the current command is supported on the current range. |
IHTMLControlRange::queryCommandValue | Returns the current value of the document, range, or current selection for the given command. |
IHTMLDialog::toString | Retrieves a string representation of the object. |
IHTMLDocument2::clear | Not supported. |
IHTMLDocument2::close | Closes an output stream and forces the sent data to display. |
IHTMLDocument2::createElement | Creates an instance of the element for the specified tag. |
IHTMLDocument2::createStyleSheet | Creates a style sheet for the document. |
IHTMLDocument2::elementFromPoint | Returns the element for the specified x coordinate and the specified y coordinate. |
IHTMLDocument2::open | Opens 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. |
IHTMLDocument2::queryCommandText | Retrieves the string associated with a command. |
IHTMLDocument2::write | Writes one or more HTML expressions to a document in the specified window. |
IHTMLDocument2::writeln | Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. |
Properties
The IHTMLDocument2 interface has these properties.
Property | Access type | Description |
---|---|---|
Read-only |
Retrieves the MIME type for the file. |
|
Read/write |
Sets or retrieves the protocol portion of a URL. |
|
Read-only |
Gets the object that has the focus when the parent document has focus. |
|
Read/write |
Sets or gets the color of all active links in the document. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all the elements in an HTML document. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all the a objects in an HTML document. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all of the applet objects in an HTML document. |
|
Read/write |
Deprecated. Sets or retrieves a value that indicates the background color behind the object. |
|
Read-only |
Gets an interface pointer to the document body object. |
|
Read/write |
Sets the character set used to encode the object. |
|
Read/write |
Sets or gets the string value of a cookiecpp. |
|
Read/write |
Gets the default character set from the current regional language settings. |
|
Read/write |
Sets or gets a value that indicates whether the document can be edited. |
|
Read/write |
Sets or gets the security domain of the document. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. |
|
Read/write |
Sets a value indicating whether arbitrary variables can be created within the object. |
|
Read/write |
Sets or gets the foreground (text) color of the document. |
|
Read-only |
Retrieves the date the file was created. |
|
Read-only |
Retrieves the date the file was last modified. |
|
Read-only |
Retrieves the file size. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all the form objects in an HTML document. |
|
Read-only |
Gets 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. |
|
Read-only |
Gets 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. |
|
Read-only |
Gets the date that the document was last modified, if the document supplies one. |
|
Read/write |
Sets or gets the color of the document links. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all of the link objects and the area objects in an HTML document. |
|
Read-only |
Gets the title of the document file. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onreadystatechange event. |
|
Read-only |
Gets a reference to the container object of the window. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. |
|
Read-only |
Gets the URL of the location that referred the user to the current document. |
|
Read-only |
Gets an interface pointer to a zero-based collection of all of the script objects in an HTML document. |
|
Read-only |
Retrieves security information for the document. |
|
Read-only |
Gets 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. |
|
Read-only |
Gets 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. |
|
Read/write |
Sets or gets the title of the document. |
|
Read/write |
Sets or gets the URL for the current document. |
|
Read/write |
Sets or gets the color of the links that the user has visited. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onafterupdate event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onbeforeupdate event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onclick event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondblclick event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragstart event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onerrorupdate event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onhelp event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeydown event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeypress event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeyup event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmousedown event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmousemove event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseout event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseover event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseup event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowenter event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowexit event. |
|
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onselectstart event. |
|
Read-only |
Retrieves the date the file was last updated. |
|
Read-only |
Retrieves a value that indicates the current state of the object. |
|
Read-only |
Retrieves an interface pointer to a location object. |
Remarks
Typically, every window object has a corresponding document object that you can get by calling the QueryIntrerface 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.
Requirements
Minimum supported client |
Windows XP |
Minimum supported server |
Windows 2000 Server |
Header |
Mshtml.h |
IDL |
Mshtml.idl |
DLL |
Mshtml.dll |