Replaces an existing child element with a new child element.
HRESULT replaceChild( IHTMLDOMNode *newChild, IHTMLDOMNode *oldChild, IHTMLDOMNode **node );
- [in] IDispatch that specifies the new element to be inserted into the document.
- [in] IDispatch that specifies the existing element to be replaced.
- [out, retval] Returns a reference to the object that is replaced.
Returns one of the following values.
S_OK The operation completed successfully. W3CException_DOM_HIERARCHY_REQUEST_ERR The node cannot be inserted at the requested location. W3CException_DOM_WRONG_DOCUMENT_ERR The node is owned by a different document and cannot be used. W3CException_DOM_NO_MODIFICATION_ALLOWED_ERR An attempt is made to modify an object that cannot be changed. W3CException_DOM_NOT_FOUND_ERR The specified node cannot be found. W3CException_DOM_NOT_SUPPORTED_ERR The requested operation is not supported.
The node to be replaced must be an immediate child of the parent object. The new node must be created using the IHTMLDocument2::createElement method.
This property is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.
Internet Explorer 9. Exceptions are only supported when webpages are displayed in IE9 Standards mode.
In Microsoft Internet Explorer 6, This method now applies to the attribute object.