The IHTMLSelectionObject interface provides the access methods for the selection object representing the active selection, a highlighted block of text, and/or other elements in the document upon which a user or a script can carry out some action.
IHTMLSelectionObject Methods
clear Clears the contents of the selection. createRange Creates a text range from the current selection. empty Deselects the current selection, sets the selection type to none, and sets the item property to NULL. get_type Retrieves the type of selection.
Interface Information
Implementation System (Mshtml.dll) 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
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
Remarks
You may use the selection object as input from the user identifying what portion of the document to act on, or as output to the user showing the results of an action.
Users and scripts can both create selections. Users create selections by dragging the mouse over a portion of the document. Scripts create them by calling the select method on a text range or similar object. You can retrieve the active selection by applying the selection keyword to the document object. You can create a text range object from the selection by using the createRange method.
A document can have only one selection at a time. The selection has a type that determines whether it is empty or contains a contiguous block of consecutive text and/or elements. Although an empty selection contains nothing, it is useful for marking a position in the document.