DHTML Methods
Expands the range so that partial units are completely contained.
bSuccess = TextRange.expand ( unit )
unit |
Required. Units to move in the range. This can be one of the following:
character |
Expands a character. |
word |
Expands a word. A word is a collection of characters terminated by a space or another white-space character, such as a tab. |
sentence |
Expands a sentence. A sentence is a collection of words terminated by an ending punctuation character, such as a period. |
textedit |
Expands to enclose the entire range. |
|
Returns TRUE if it successfully expands the range, or FALSE otherwise.
This feature might not be available on non-Win32® platforms. See the Microsoft® Knowledge Base for the latest information on Internet Explorer® cross-platform compatibility.
The following example creates a range from the current selection and then uses expand to ensure that any word partially enclosed by the range becomes entirely enclosed in the range.
var rng = document.selection.createRange ( );
rng.expand ( "word" );
TextRange
collapse