Click to return to the Reusing Browser Technology home page    
IHTMLSelectElement::tags ...     IHTMLSelectionObject::cle...     Interfaces and Scripting ...    
Web Workshop  |  Reusing Browser Technology

IHTMLSelectionObject Interface


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.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.