Export (0) Print
Expand All

IHTMLSelection interface

Represents the active selection, which is typically a highlighted block of text or other elements in the document. The active selection can be used to complete an action issued by a user or a script.

Members

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

Methods

The IHTMLSelection interface has these methods.

MethodDescription
addRange

Adds a Range to the current selection.

collapse

Replaces the current selection with an empty selection (or a caret) at the given offset.

collapseToEnd

Collapses or sets the insertion point or caret at the end of a selection object.

collapseToStart

Collapses, or sets the insertion point or caret at the beginning of a selection object.

deleteFromDocument

Deletes the selected nodes from a document.

getRangeAt

Returns a specified Range from a selection. The Range is specified by an index and cannot be greater than the number that is returned by IHTMLSelection::rangeCount.

removeAllRanges

Removes all ranges from a selection.

removeRange

Removes a range from a selection.

selectAllChildren

Replaces the current selection with all the contents of the given node.

 

Properties

The IHTMLSelection interface has these properties.

PropertyDescription

anchorNode

Returns the element or node that contains the start of the selection.

anchorOffset

Retrieves the starting position of a selection that is relative to the IHTMLSelection::anchorNode.

focusNode

Retrieves the element or node that contains the end of a selection.

focusOffset

Retrieves the end position of a selection that is relative to the IHTMLSelection::focusNode.

isCollapsed

Retrieves whether a selection is collapsed or empty.

rangeCount

Returns the number of ranges in a selection

 

Requirements

Minimum supported client

Windows Vista with SP1, Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch

 

 

Community Additions

ADD
Show:
© 2015 Microsoft