createTextNode method
Creates a text string from the specified value.
![]() |
Syntax
var retval = document.createTextNode(text);Parameters
Return value
Type: IHTMLDOMNode
Returns the created TextNode object.Standards information
Remarks
This method always returns S_OK, so you must check the returned newTextNode value. If newTextNode is NULL, the method failed to create a new text node.
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
Send comments about this topic to Microsoft
Build date: 11/27/2012
