Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  DHTML, HTML & CSS

innerText Property


Sets or retrieves the text between the start and end tags of the current object.

Syntax

HTMLN/A
Scriptingobject.innerText [ = sTxt ]

Possible Values

sTxtString 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>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

See Also

insertAdjacentText


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site