Edit This Code:
<!DOCTYPE html>
<html>
<body>

<iframe src="../default.asp.html" style="height:380px;width:520px;"></iframe>

<p>Click the "Try it" button to adopt and display the value of the first H1 element in the iframe (another document).</p>

<p><strong>Note:</strong> Internet explorer 8 and earlier does not support the adoptNode() method.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var frame = document.getElementsByTagName("IFRAME")[0]
    var h = frame.contentWindow.document.getElementsByTagName("H1")[0];
    var x = document.adoptNode(h);
    document.body.appendChild(x);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy