Click to return to the DHTML, HTML     
createStyleSheet Method     createTextRange Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

createTextNode Method


Creates a text string from the specified value.

Syntax

oTextNode = document.createTextNode([sText])

Parameters

sTextOptional. String that specifies the nodeValue property of the text node.

Return Value

Returns a TextNode object.

Example

This example uses the createTextNode method to create a text node and replace it with an existing text node in a SPAN object.

<SCRIPT>
function fnChangeNode(){
   var oTextNode = document.createTextNode("New Text");
   var oReplaceNode = oSpan.childNodes(0);
   oReplaceNode.replaceNode(oTextNode);
}
<SCRIPT>

<SPAN ID = oSPAN onclick="fnChangeNode()">
Original Text
</SPAN>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
document

See Also

createElement



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

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