O'Reilly logo

Dynamic HTML: The Definitive Reference by Danny Goodman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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( )

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required