javascript TextRange expand( )

expand( )NN n/a IE 4(Win) DOM n/a  

expand("unit")

  

Expands the current text range (including a collapsed range) to encompass the textual unit passed as a parameter. For example, if someone selects some characters from a document, you can create the range and expand it to encompass the entire sentence in which the selection takes place:

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

If the starting range extends across multiple units, the expand( ) method expands the range outward to the next nearest unit.

 
Parameters
 
  • A case-insensitive string value of the desired unit: character | word | sentence | textedit. The textedit value expands the range to the entire original range.
 
Returned Value

Boolean value: true if method is successful; false if unsuccessful.


2105,Nickname,Homepage or email,Comments here,Add comment