Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

add table element from iframe to parent

4 views
Skip to first unread message

strauchdieb

unread,
Aug 22, 2006, 11:26:55 AM8/22/06
to
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);
}

Martin Honnen

unread,
Aug 22, 2006, 12:17:48 PM8/22/06
to

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/

strauchdieb

unread,
Aug 22, 2006, 3:54:17 PM8/22/06
to
thx martin.
that works for me.

0 new messages