次の方法で共有


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

IHTMLAnchorElement::mimeType

Read-only

Retrieves the MIME type for the file.

IHTMLAnchorElement::protocol

Read/write

Sets or retrieves the protocol portion of a URL.

IHTMLDocument2::activeElement

Read-only

Gets the object that has the focus when the parent document has focus.

IHTMLDocument2::alinkColor

Read/write

Sets or gets the color of all active links in the document.

IHTMLDocument2::all

Read-only

Gets an interface pointer to a zero-based collection of all the elements in an HTML document.

IHTMLDocument2::anchors

Read-only

Gets an interface pointer to a zero-based collection of all the a objects in an HTML document.

IHTMLDocument2::applets

Read-only

Gets an interface pointer to a zero-based collection of all of the applet objects in an HTML document.

IHTMLDocument2::bgColor

Read/write

Deprecated. Sets or retrieves a value that indicates the background color behind the object.

IHTMLDocument2::body

Read-only

Gets an interface pointer to the document body object.

IHTMLDocument2::charset

Read/write

Sets the character set used to encode the object.

IHTMLDocument2::cookie

Read/write

Sets or gets the string value of a cookiecpp.

IHTMLDocument2::defaultCharset

Read/write

Gets the default character set from the current regional language settings.

IHTMLDocument2::designMode

Read/write

Sets or gets a value that indicates whether the document can be edited.

IHTMLDocument2::domain

Read/write

Sets or gets the security domain of the document.

IHTMLDocument2::embeds

Read-only

Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document.

IHTMLDocument2::expando

Read/write

Sets a value indicating whether arbitrary variables can be created within the object.

IHTMLDocument2::fgColor

Read/write

Sets or gets the foreground (text) color of the document.

IHTMLDocument2::fileCreatedDate

Read-only

Retrieves the date the file was created.

IHTMLDocument2::fileModifiedDate

Read-only

Retrieves the date the file was last modified.

IHTMLDocument2::fileSize

Read-only

Retrieves the file size.

IHTMLDocument2::forms

Read-only

Gets an interface pointer to a zero-based collection of all the form objects in an HTML document.

IHTMLDocument2::frames

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.

IHTMLDocument2::images

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.

IHTMLDocument2::lastModified

Read-only

Gets the date that the document was last modified, if the document supplies one.

IHTMLDocument2::linkColor

Read/write

Sets or gets the color of the document links.

IHTMLDocument2::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.

IHTMLDocument2::nameProp

Read-only

Gets the title of the document file.

IHTMLDocument2::onreadystatechange

Read/write

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

IHTMLDocument2::parentWindow

Read-only

Gets a reference to the container object of the window.

IHTMLDocument2::plugins

Read-only

Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document.

IHTMLDocument2::referrer

Read-only

Gets the URL of the location that referred the user to the current document.

IHTMLDocument2::scripts

Read-only

Gets an interface pointer to a zero-based collection of all of the script objects in an HTML document.

IHTMLDocument2::security

Read-only

Retrieves security information for the document.

IHTMLDocument2::selection

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.

IHTMLDocument2::styleSheets

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.

IHTMLDocument2::title

Read/write

Sets or gets the title of the document.

IHTMLDocument2::URL

Read/write

Sets or gets the URL for the current document.

IHTMLDocument2::vlinkColor

Read/write

Sets or gets the color of the links that the user has visited.

IHTMLElement::onafterupdate

Read/write

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

IHTMLElement::onbeforeupdate

Read/write

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

IHTMLElement::onclick

Read/write

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

IHTMLElement::ondblclick

Read/write

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

IHTMLElement::ondragstart

Read/write

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

IHTMLElement::onerrorupdate

Read/write

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

IHTMLElement::onhelp

Read/write

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

IHTMLElement::onkeydown

Read/write

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

IHTMLElement::onkeypress

Read/write

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

IHTMLElement::onkeyup

Read/write

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

IHTMLElement::onmousedown

Read/write

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

IHTMLElement::onmousemove

Read/write

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

IHTMLElement::onmouseout

Read/write

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

IHTMLElement::onmouseover

Read/write

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

IHTMLElement::onmouseup

Read/write

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

IHTMLElement::onrowenter

Read/write

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

IHTMLElement::onrowexit

Read/write

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

IHTMLElement::onselectstart

Read/write

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

IHTMLImgElement::fileUpdatedDate

Read-only

Retrieves the date the file was last updated.

IHTMLLinkElement::readyState

Read-only

Retrieves a value that indicates the current state of the object.

IHTMLWindow2::location

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

See also

IDispatch