6 out of 14 rated this helpful - Rate this topic

TextNode object

[This documentation is preliminary and is subject to change.]

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

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.

Examples

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</li>
</ul>

 

 

Build date: 2/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ