asp.net.ph

Skip Navigation Links

TextNode Object

Language References


DOM Level 1 Specification.

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

Remarks

Use the createTextNode method to create a TextNode object. Once created, the TextNode can be added to the document using the appendChild, replaceNode, or insertBefore methods.

Members

TextNode Members

Example

The following sample demonstrates the use of the TextNode object to change the text of a LI object.

<script language="JavaScript">
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>


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note