共用方式為


IHTMLDOMRange interface

IHTMLDOMRange specifies a general way to select content between a two boundary points.

Members

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

  • Methods
  • Properties

Methods

The IHTMLDOMRange interface has these methods.

Method Description
cloneContents

Returns a document fragment containing the nodes of a range. If any nodes are partially selected, their start or end nodes are included.

cloneRange

Returns a new range with boundary points that are equal to the original range.

collapse

Collapses (or removes) a range by moving the insertion point to the beginning or end of the current range.

compareBoundaryPoints

Compares two ranges by comparing their boundary points.

deleteContents

Removes all contents within a selected range.

detach

Removes or detaches an object and associated resources.

extractContents

Removes the contents of a range from a document or document fragment and puts it a new document fragment.

getBoundingClientRect

Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

getClientRects

Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

insertNode

Inserts a node into the start of a Range object.

selectNode

Selects a range node and all of its contents.

selectNodeContents

Selects the contents within a node in a range.

setEnd

Sets the end point of the range.

setEndAfter

Sets the end of a range to a point after a specific node.

setEndBefore

Sets the end of the range to a point before a specific node.

setStart

Sets the starting point of a range.

setStartAfter

Sets the starting point of the range to a point after a specific node.

setStartBefore

Sets the start point of a range to a point before a specific node.

surroundContents

Moves the contents of a Range to a new parent node, placing the new parent node at the start position of the Range.

 

Properties

The IHTMLDOMRange interface has these properties.

Property Description

collapsed

Retrieves whether a range is collapsed or empty.

commonAncestorContainer

Returns the deepest node in which two boundary points exist.

endContainer

Retrieves the end point node of the current range.

endOffset

Retrieves the ending boundary point relative to the IHTMLDOMRange::startContainer in the current range.

startContainer

Retrieves the starting node of a current range.

startOffset

Retrieves the offset of the starting boundary point relative to the IHTMLDOMRange::startContainer in the current range.

 

Requirements

Minimum supported client

Windows Vista with SP1, Windows 7

Minimum supported server

Windows Server 2008 R2

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch