www.webdeveloper.com
Results 1 to 3 of 3

Thread: Need Help With Copying Iframe

  1. #1
    Join Date
    Mar 2008
    Posts
    3

    Unhappy Need Help With Copying Iframe

    Hi all,

    I need to copy my iframe from a cell to another cell in the html table, I have the following code:

    <html>
    <head>
    <script>
    function startWorking() {
    var targetFrame=document.getElementById("myDiv");
    var targetTD=document.getElementById("td1");
    targetTD.appendChild(targetFrame);
    }
    </script>
    </head>
    <body>
    <div>
    <input type="button" value="Start" onclick="startWorking()"/>
    </div>
    <table border=1>
    <tr>
    <td id="td1">
    ABCDEFG
    </td>
    <td id="td2">
    <div id="myDiv">
    <iframe src="http://www.google.com.au" border="1" height="200" width="200">
    </div>
    </td>
    </tr>
    </table>
    </body>
    </html>

    It works perfectly in IE, however, in firefox when I press the button the copied iframe be refreshed, I don't like that. Does anyone able to give me a light?

    Thanks!

  2. #2
    Join Date
    Feb 2008
    Posts
    1,666
    Quote Originally Posted by doublezz View Post
    It works perfectly in IE, however, in firefox when I press the button the copied iframe be refreshed, I don't like that.
    Sorry, you'll have to chalk that one up to browser differences. Technically, though, you should not take an existing document element and append it in another place in the document without removing it from the original place. If you change that, though, I don't expect it to help the other issue.
    Last edited by MrNobody; 02-03-2009 at 07:02 PM.

  3. #3
    Join Date
    Mar 2008
    Posts
    3
    Quote Originally Posted by MrNobody View Post
    Sorry, you'll have to chalk that one up to browser differences. Technically, though, you should not take an existing document element and append it in another place in the document without removing it from the original place. If you change that, though, I don't expect it to help the other issue.

    Thanks for the reply MrNobody,

    I have also tried with removing the child node before copying but still does not help.

    What I need is to just move the iframe from td2 to td1 without refreshing the iframe content

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles