HBCMS更多的中文手册参考:

expand Method

DHTML文档教程

Expands the range so that partial units are completely contained.

dhtml语法

bSuccess = TextRange.expand(sUnit)

Parameters

sUnit Required. Stringthat 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 that returns one of the following values:

trueThe range was successfully expanded.
falseThe range was not expanded.

Remarks

This feature might not be available on non-Microsoft® Win32® platforms.

DHTML代码范例

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");

是否符合公共标准

There is no public standard that applies to this method.

Applies To

TextRange

更多语法参考

collapse