asp.net.ph

Skip Navigation Links

TextRange Object

Language References


HTML 2, 3.2, 4, 4.01, 5

Represents text in an HTML element.

Remarks

You can use this object to retrieve and modify text in an element, to locate specific strings in the text, and to carry out commands that affect the appearance of the text.

You can retrieve a text range object by applying the createTextRange method to a BODY, BUTTON, TEXTAREA, or HTMLAREA element or an INPUT element that has text type. You can modify the extent of the text range by moving its start and end positions with methods such as move, moveToElementText, and findText. Within the text range, you can retrieve and modify plain text or HTML text. These forms of text are identical except that HTML text includes HTML tags; plain text does not.

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 JScript™ ( compatible with ECMA-262 language specification ) example changes the text of a BUTTON element to "Clicked".

var b = document.all.tags ( "BUTTON" );
if ( b != null ) {
   var r = b[0].createTextRange ( );
   if ( r != null ) {
      r.text = "Clicked";
   }
}

Members

TextRange Members

See Also

createTextRange



© 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