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
Script Gets 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 Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 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
activeElement Gets the object that has the focus when the parent document has focus. alinkColor Sets or gets the color of all active links in the document. all Gets an interface pointer to a zero-based collection of all the elements in an HTML document. anchors Gets an interface pointer to a zero-based collection of all the a objects in an HTML document. applets Gets an interface pointer to a zero-based collection of all of the applet objects in an HTML document. bgColor Deprecated. Sets or retrieves a value that indicates the background color behind the object. body Gets an interface pointer to the document body object. charset Sets or retrieves the character set used to encode the object. clear Not currently supported. close Closes an output stream and forces the sent data to display. cookie Sets or gets the string value of a cookie. createElement Creates an instance of the element for the specified tag. createStyleSheet Creates a style sheet for the document. defaultCharset Gets the default character set from the current regional language settings. designMode Sets or gets a value that indicates whether the document can be edited. domain Sets or gets the security domain of the document. elementFromPoint Returns the element for the specified x coordinate and the specified y coordinate. embeds Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. execCommand Executes a command on the current document, current selection, or the given range. execCommandShowHelp Displays help information for the given command identifier. expando Sets or retrieves a value indicating whether arbitrary variables can be created within the object. fgColor Sets or gets the foreground (text) color of the document. fileCreatedDate Retrieves the date the file was created. fileModifiedDate Retrieves the date the file was last modified. fileSize Retrieves the file size. fileUpdatedDate Retrieves the date the file was last updated. forms Gets an interface pointer to a zero-based collection of all the form objects in an HTML document. frames 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. images 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. lastModified Gets the date that the page was last modified, if the page supplies one. linkColor Sets or gets the color of the document links. links Gets an interface pointer to a zero-based collection of all of the link objects and the area objects in an HTML document. location Retrieves an interface pointer to a location object. mimeType Retrieves the MIME type for the file. nameProp Gets the title of the document file. onafterupdate Sets or retrieves a pointer to the event handler function associated with the onafterupdate event. onbeforeupdate Sets or retrieves a pointer to the event handler function associated with the onbeforeupdate event. onclick Sets or retrieves a pointer to the event handler function associated with the onclick event. ondblclick Sets or retrieves a pointer to the event handler function associated with the ondblclick event. ondragstart Sets or retrieves a pointer to the event handler function associated with the ondragstart event. onerrorupdate Sets or retrieves a pointer to the event handler function associated with the onerrorupdate event. onhelp Sets or retrieves a pointer to the event handler function associated with the onhelp event. onkeydown Sets or retrieves a pointer to the event handler function associated with the onkeydown event. onkeypress Sets or retrieves a pointer to the event handler function associated with the onkeypress event. onkeyup Sets or retrieves a pointer to the event handler function associated with the onkeyup event. onmousedown Sets or retrieves a pointer to the event handler function associated with the onmousedown event. onmousemove Sets or retrieves a pointer to the event handler function associated with the onmousemove event. onmouseout Sets or retrieves a pointer to the event handler function associated with the onmouseout event. onmouseover Sets or retrieves a pointer to the event handler function associated with the onmouseover event. onmouseup Sets or retrieves a pointer to the event handler function associated with the onmouseup event. onreadystatechange Sets or retrieves a pointer to the event handler function associated with the onreadystatechange event. onrowenter Sets or retrieves a pointer to the event handler function associated with the onrowenter event. onrowexit Sets or retrieves a pointer to the event handler function associated with the onrowexit event. onselectstart Sets or retrieves a pointer to the event handler function associated with the onselectstart event. 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. parentWindow Gets a reference to the container object of the window. plugins Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. protocol Sets or retrieves the protocol portion of a URL. queryCommandEnabled Returns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLDocument2::execCommand, given the current state of the document. queryCommandIndeterm Returns a Boolean value that indicates whether the specified command is in the indeterminate state. queryCommandState Returns a Boolean value that indicates the current state of the command. queryCommandSupported Returns a Boolean value that indicates whether the current command is supported on the current range. queryCommandText Retrieves the string associated with a command. queryCommandValue Returns the current value of the document, range, or current selection for the given command. readyState Retrieves a value that indicates the current state of the object. referrer Gets the URL of the location that referred the user to the current page. scripts Gets an interface pointer to a zero-based collection of all of the script objects in an HTML document. security Not implemented. selection 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. styleSheets 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. title Sets or gets the title of the document. toString Retrieves a string representation of the object. URL Sets or gets the URL for the current document. vlinkColor Sets or gets the color of the links that the user has visited. write Writes one or more HTML expressions to a document in the specified window. writeln Writes 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 Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0, Windows CE 2.12
IHTMLDocument3 Interface
Provides access to additional properties and methods of the document objects.
IHTMLDocument3 Members
attachEvent Binds the specified function to an event, so that the function gets called whenever the event fires on the object. baseUrl Not currently supported. childNodes Gets the child nodes of the document object. createDocumentFragment Creates a new document and returns a pointer to the newly created document. createTextNode Creates a text string from the specified value. detachEvent Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires. dir Sets or retrieves a value that indicates the reading order of the object. documentElement Gets a reference to the root node of the document. enableDownload Not currently supported. getElementById Returns a reference to the first object with the specified value of the ID or NAME attribute. getElementsByName Gets a collection of objects based on the value of the NAME or ID attribute. getElementsByTagName Retrieves a collection of objects based on the specified element name. inheritStyleSheets Not currently supported. onbeforeeditfocus Sets or retrieves a pointer to the event handler function associated with the onbeforeeditfocus event. oncellchange Sets or retrieves a pointer to the event handler function associated with the oncellchange event. oncontextmenu Sets or retrieves a pointer to the event handler function associated with the oncontextmenu event. ondataavailable Sets or retrieves a pointer to the event handler function associated with the ondataavailable event. ondatasetchanged Sets or retrieves a pointer to the event handler function associated with the ondatasetchanged event. ondatasetcomplete Sets or retrieves a pointer to the event handler function associated with the ondatasetcomplete event. onpropertychange Sets or retrieves a pointer to the event handler function associated with the onpropertychange event. onrowsdelete Sets or retrieves a pointer to the event handler function associated with the onrowsdelete event. onrowsinserted Sets or retrieves a pointer to the event handler function associated with the onrowsinserted event. onstop Sets or gets a pointer to the event handler function associated with the event. parentDocument Gets an interface pointer that provides access to the document interface for the parent object. recalc Recalculates all dynamic properties in the current document. releaseCapture Removes mouse capture from the object in the current document. uniqueID Retrieves an autogenerated, unique identifier for the object.
Interface Information
Stock Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 5 Minimum operating systems Windows 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
createDocumentFromUrl Creates a new document object from an existing URL. createEventObject Generates an event object to pass event context information when you use the IHTMLDocument4::fireEvent method. createRenderStyle Creates an IHTMLRenderStyle interface. fireEvent Fires a specified event on the object. focus Causes the document to receive the focus. hasFocus Gets a value indicating whether the object currently has focus. media Not currently supported. namespaces Gets the collection of all namespace objects associated with the document. oncontrolselect Sets or retrieves a pointer to the event handler function associated with the oncontrolselect event. onselectionchange Sets or gets a pointer to the event handler function associated with the onselectionchange event. URLUnencoded Gets the URL for the document, stripped of any character encoding.
Interface Information
Stock Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files mshtml.h, mshtml.idl Minimum availability Internet Explorer 5.5 Minimum operating systems Windows 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
compatMode Gets a value that indicates whether standards-compliant mode is switched on for the object. createAttribute Creates an IHTMLDOMAttribute interface with a specified name. createComment Creates an IHTMLCommentElement2 interface with the specified data. doctype Gets the document type declaration associated with the current document. implementation Gets the implementation object of the current document. onactivate Sets or retrieves a pointer to the event handler function associated with the onactivate event. onbeforeactivate Sets or retrieves a pointer to the event handler function associated with the onbeforeactivate event. onbeforedeactivate Sets or retrieves a pointer to the event handler function associated with the onbeforedeactivate event. ondeactivate Sets or retrieves a pointer to the event handler function associated with the ondeactivate event. onfocusin Sets or retrieves a pointer to the event handler function associated with the onfocusin event. onfocusout Sets or retrieves a pointer to the event handler function associated with the onfocusout event. onmousewheel Sets 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 Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files mshtml.h, mshtml.idl Minimum availability Internet Explorer 6 Minimum operating systems Windows 98, Windows NT 4.0
See Also
IHTMLDocument6 Interface
Extends IHTMLDocument5 with support for document compatibility modes and DOM Storage events.
IHTMLDocument6 Members
compatible Retrieves the collection of user agents and versions declared in the X-UA-Compatible
documentMode Retrieves the document compatibility mode of the document. getElementById Returns a reference to the first object with the specified ID value. onstorage Sets or retrieves a pointer to the event handler function associated with the DOM Storage event. onstoragecommit Sets or retrieves a pointer to the event handler function associated with the DOM Storage updateSettings Allows updating the print settings for the page.
Interface Information
Stock Implementation mshtml.dll Custom Implementation No Inherits from IDispatch Header and IDL files mshtml.h, mshtml.idl Minimum availability Internet Explorer 8 Minimum operating systems Windows XP SP2
See Also
Defining Document Compatibility