createTextNode Method

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:
Version data is listed when the mouse hovers over a link, or the link has focus.
document

See Also

createElement


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.