Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Copies a reference to the object from the document hierarchy.
![]() |
Syntax
IHTMLDOMNode retVal = object.cloneNode(fDeep);
Parameters
fDeep [in, optional]
Type: VARIANT_BOOL
VARIANT_BOOL that specifies one of the following values:
VARIANT_FALSE (FALSE)
Cloned objects do not include childNodes.
VARIANT_TRUE (TRUE)
Cloned objects include childNodes.
Standards information
Remarks
The IHTMLDOMNode::cloneNode method copies an object, attributes, and, if specified, the childNodes.
When you refer to the IHTMLElement::id of a cloned element, a collection is returned.
IHTMLDOMNode::cloneNode does not work on an IFRAME directly. You must call IHTMLDOMNode::cloneNodethrough the all collection. The following example demonstrates how to call IHTMLDOMNode::cloneNode on an IFRAME.
<!DOCTYPE html>
<html>
<head>
<title><iframe></title>
</head>
<body onload="fnBegin()">
<iframe id="oFrame" src="about:blank" style="border: 1px solid black; position: absolute; top: 20px; left: 30px; width: 350px; height: 300px;"></iframe>
<script>
function fnBegin() {
var fr = document.all.oFrame.cloneNode();
console.log(document.body.innerHTML);
}
</script>
</body>
</html>
If the object being cloned is an element and that element has expandos defined on it, the expandos are copied to the clone when IHTMLDOMNode::cloneNode is called. Other browsers might handle this differently.
In Microsoft Internet Explorer 6, this method applies to the attribute object.
See also
Reference
.png)