Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Objects
 TextNode Object

  Switch on low bandwidth view
TextNode Object

Represents a string of text as a node in the document hierarchy.

Members Table

The following table lists the members exposed by the TextNode object.

Attributes/Properties
Show:
PropertyDescription
constructor New for Windows Internet Explorer 8  Returns a references to the constructor of an object.
data Sets or gets the value of a TextNode object.
length Gets the number of characters in a TextNode object.
nextSibling Retrieves a reference to the next child of the parent for the object.
nodeName Retrieves the name of a particular type of node.
nodeType Retrieves the type of the requested node.
nodeValue Sets or retrieves the value of a node.
parentNode Retrieves the parent object in the document hierarchy.
previousSibling Retrieves a reference to the previous child of the parent for the object.
MethodDescription
appendData Adds a new character string to the end of the object.
deleteData Removes a specified range of characters from the object.
insertData Inserts a new character string in the object at a specified offset.
replaceData Replaces a specified range of characters in the object with a new character string.
splitText Divides a text node at the specified index.
substringData Extracts a range of characters from the object.
ObjectDescription
Text Constructor New for Internet Explorer 8  Defines the properties and methods inherited by objects in the Text Constructor prototype chain.

Remarks

Use the createTextNode method to create a TextNode object. After you create the TextNode, you can add to it using the appendChild, replaceNode, or insertBefore methods.

This object is available in script as of Microsoft Internet Explorer 5.

Example

This example uses the TextNode object to change the text of an li object.

<SCRIPT>
function fnChangeText(){
   var oTextNode = document.createTextNode("New List Item 1");
   var oReplaceNode = oItem1.firstChild.replaceNode(oTextNode);
}
</SCRIPT>

<UL onclick = "fnChangeText()">
<LI ID = oItem1>List Item 1
</UL>

Standards Information

This object is defined in HTML 3.2 World Wide Web link.

Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker