TOC PREV NEXT INDEX

domref



insertNode


Insert a node at the start of a Range.

Syntax

range.insertNode(newNode);
 

Parameters

newNode is a Node.

Example

range = document.createRange();
 
newNode = document.createElement("p"):
 
newNode.appendChild(document.createTextNode("New Node Inserted Here"));
 
range.selectNode(document.getElementsByTagName("div").item(0));
 
range.insertNode(newNode);
 

Notes

newNode is inserted at the start boundary point of the Range. If the newNodes is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text Nodes (Blocked by http://bugzilla.mozilla.org/show_bug.cgi?id=135922 )

If newNode is a document fragment, the children of the document fragment are inserted instead.

Specification

insertNode


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX