add table element from iframe to parent

Discussion in 'Javascript' started by strauchdieb, Aug 22, 2006.

  1. strauchdieb

    strauchdieb Guest

    hi,

    i have a non-visible iframe on my page. in that iframe i load data in a
    htmltable. if the data is ready, i want to take this table out of the
    iframe and insert it in the parent. as soon as the data is ready, i
    call a js.-method in my parent from within the iframe. this method has
    one parameter, the table object.
    no my problem:
    in my parent i get the specific parent element with
    getElementById("elementId"), in which i will add my table. now i add
    the table with appendChild(tableObject) to that element. this call
    works in firefox but don't work in ie. what's wrong with that? can
    anyone help?

    the code in my parent file looks like the following:
    function SetDataTable(tableToInsert)
    {
    document.getElementById("tableHolder").appendChild(tableToInsert);
    }
     
    strauchdieb, Aug 22, 2006
    #1
    1. Advertising

  2. strauchdieb wrote:


    > the code in my parent file looks like the following:
    > function SetDataTable(tableToInsert)
    > {
    > document.getElementById("tableHolder").appendChild(tableToInsert);
    > }


    IE currrently has no support to insert a HTML DOM node from one document
    into another HTML document.
    The W3C wants you to do

    node1.appendChild(node1.ownerDocument.importNode(nodeFromOtherDocument,
    true))
    but IE does not support that importNode method. Mozilla and Opera
    support importNode but Mozilla and Opera 9 (but not Opera 8) will not
    complain if you don't use importNode but simply move nodes between
    documents with appendChild.

    For IE all you can do is use its insertAdjacentHTML method to insert the
    markup of an element node e.g. for your example
    document.getElementById("tableHolder").insertAdjacentHTML('beforeEnd',
    tableToInsert.outerHTML);

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Aug 22, 2006
    #2
    1. Advertising

  3. strauchdieb

    strauchdieb Guest

    thx martin.
    that works for me.
     
    strauchdieb, Aug 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    686
  2. Scott
    Replies:
    6
    Views:
    959
    [MSFT]
    Apr 14, 2004
  3. Replies:
    0
    Views:
    141
  4. PD
    Replies:
    6
    Views:
    717
  5. Replies:
    0
    Views:
    138
Loading...

Share This Page