Creates a text string from the specified value.
Syntax
oTextNode = document.createTextNode([sText])
Parameters
sText Optional. 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
document
See Also