expand Method

DHTML, HTML, & CSS

 
Click to return to the DHTML, HTML & CSS home page    
execScript Method     findText Method     DHTML Methods    

expand Method


Expands the range so that partial units are completely contained.

Syntax

bSuccess = TextRange.expand(sUnit)

Parameters

sUnitRequired. String that specifies the units to move in the range, using one one of the following values:
characterExpands a character.
wordExpands a word. A word is a collection of characters terminated by a space or another white-space character, such as a tab.
sentenceExpands a sentence. A sentence is a collection of words terminated by an ending punctuation character, such as a period.
texteditExpands to enclose the entire range.

Return Value

Boolean. Returns true if it successfully expands the range, or false otherwise.

Remarks

This feature might not be available on non-Win32® platforms. For the latest information about Internet Explorer cross-platform compatibility, see article q172976Internet Link Non-MSDN link in the Microsoft Knowledge Base.

Example

This example creates a range from the current selection and uses the expand method to ensure that any word partially enclosed in the range becomes entirely enclosed in the range.

var rng = document.selection.createRange();
rng.expand("word");

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.

TextRange

See Also

collapse


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.