Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Sets or retrieves the text between the start and end tags of the current object.
Syntax
HTML N/A Scripting object.innerText [ = sTxt ]
Possible Values
sTxt String of text. The property is read/write with no default value.
Remarks
When setting the property, the given string completely replaces the existing content of the object, except for HTML, HEAD, and TITLE tags.
The property cannot be set while the document is loading. Wait for the onload event before attempting to set it. If a tag is dynamically created using TextRange, innerHTML, or outerHTML, use JScript™ (compatible with ECMA 262 language specification) to create new events to handle the newly formed tags (VBScript is not supported).
InnerText is read-only on the following objects: HTML, TABLE, TBODY, TFOOT, THEAD, TR.
Example
The following example shows that when the innerText property is used to replace an object's contents, the object surrounding the text is not replaced.
Sample Code
<P ID=oPara>Here's the text that will change.</P> : <BUTTON onclick="oPara.innerText='WOW! It changed!'">Change text</BUTTON> <BUTTON onclick="oPara.innerText='And back again'">Reset</BUTTON>
Applies To
A, ACRONYM, ADDRESS, B, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COMMENT, DD, DEL, DFN, DIR, EM, FIELDSET, FONT, FORM, HEAD, Hn, HTML, HTMLAREA, I, IFRAME, INS, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, NEXTID, NOBR, OL, OPTION, P, PLAINTEXT, PRE, Q, RB, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP, XMP
See Also
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.