Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Expands the range so that partial units are completely contained.
Syntax
bSuccess = TextRange.expand(unit)
Parameters
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.
Return Value
Returns TRUE if it successfully expands the range, or FALSE otherwise.
Remarks
This feature might not be available on non-Win32® platforms. See article Q172976
in the Microsoft® Knowledge Base for the latest information on Internet Explorer cross-platform compatibility.
Example
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");
Applies To
See Also
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.