DHTML Methods
Creates a TextRange object for the given object. Use a text range to examine and modify the text within an object.
oTextRange = object.createTextRange ( )
Returns a text range object if successful, or null otherwise.
The following JScript™ ( compatible with ECMA-262 language specification ) example creates a text range for the document and then uses the range to display all text and HTML tags in the document.
var rng = document.body.createTextRange ( );
if ( rng!=null ) {
alert ( rng.htmlText );
}
The following JScript™ example creates a text range for the first BUTTON element in the document and then uses the text range to change the text in the button.
var coll = document.all.tags ( "BUTTON" );
if ( coll!=null && coll.length>0 ) {
var rng = coll [ 0 ] .createTextRange ( );
rng.text = "Clicked";
}
BODY, BUTTON, HTMLAREA, INPUT type=button, INPUT type=hidden, INPUT type=password, INPUT type=reset, INPUT type=submit, INPUT type=text, TEXTAREA