Contents Index Topic Contents | ||
Previous Topic: TEXTAREA Next Topic: TFOOT |
TextRange
Description
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, or TEXTAREA element or an INPUT element having 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 article Q172976 in the Microsoft® Knowledge Base for the latest information on Internet Explorer cross-platform compatibility.
Example
The following JScript 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"; } }Properties
htmlText, text, boundingHeight, boundingLeft, boundingTop, boundingWidth, offsetLeft, offsetTop
Methods
collapse, compareEndPoints, duplicate, execCommand, expand, findText, getBookmark, inRange, isEqual, move, moveEnd, moveStart, moveToBookmark, moveToElementText, moveToPoint, parentElement, pasteHTML, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandValue, scrollIntoView, select, setEndPoint
See Also
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.