expandexpand*
*



Contents  *



Index  *Topic Contents
*Previous Topic: execScript
*Next Topic: findText

expand

Description

Expands the range so that partial units are completely contained.

Syntax

Boolean = object.expand(unit)

ParameterDescription
unit Units to move in the range. 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 other white-space character.
sentence Expands a sentence. A sentence is a collection of words terminated by a 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, 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

TextRange

See Also

collapse


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.