asp.net.ph

Skip Navigation Links

expand Method

DHTML Methods


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

TextRange

See Also

collapse



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note