How to use DOM Object ImportNode in JavaScript

In this article I am going to explain about DOM object importNode() method in JavaScript.
  • 2395

JavaScript DOM Object ImportNode() Method

JavaScript importNode() method use for import the element from another document. Its  can be import any types of element.



Example // In this example when you will click on button then a message will be display.



    <script type="text/javascript">

        function myfun() {

            var frame = document.getElementsByTagName("iframe")[0]

            var ss = frame.contentWindow.document.getElementsByTagName("h1")[0];



            var mm = document.importNode(ss, true);







    <button onclick="myfun()">

        click me</button>

    <p id="test">

        click button for import page</p>

    <iframe src="HTMLPage2.htm" style="height: 280px; width: 420px;"></iframe>







You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.