Name

TextRange — NN n/a IE 4 DOM n/a

Synopsis

The TextRange object represents the text of zero or more characters in a document. When a text range consists of zero characters, it represents an insertion point between two characters (or before the first or after the last character).

A TextRange object is created via the createTextRange( ) method associated with the BODY, BUTTON, text, or TEXTAREA objects. Once a text range is created, use its methods to adjust its start and end point to encompass a desired segment of the text (such as text that matches a search string). Once the range has been narrowed to the target text, assign values to its htmlText and text properties to change, remove, or insert text. A library of direct commands that perform specific textual modifications can also be invoked to act on the text range. See Chapter 5, for details and examples of using the TextRange object.

Note that the TextRange object and all associated facilities are available only in the Win32 version of Internet Explorer 4.

Object Model Reference

IE

objectRef .createTextRange( )

Properties

boundingHeight

boundingTop

boundingWidth

htmlText

text

boundingLeft

    

Methods

collapse( )

move( )

queryCommandIndeterm( )

compareEndPoints( )

moveEnd( )

queryCommandState( )

duplicate( )

moveStart( )

queryCommandSupported()

execCommand( )

moveToBookmark( )

queryCommandText( )

expand( )

moveToElementText( )

queryCommandValue( )

findText( )

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.