add table element from iframe to parent

S

strauchdieb

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);
}
 
M

Martin Honnen

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);
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top