Creates a text string from the specified value.
![]() |
Syntax
var retval = document.createTextNode(text);Parameters
- text [in, optional]
-
Type: String
A String that specifies the nodeValue property of the text node.
Return value
Type: IHTMLDOMNode
Returns the created TextNode object.Standards information
Examples
<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>
See also
- document
- Reference
- createElement
- Conceptual
- About the W3C Document Object Model
Build date: 11/28/2012
