Can't move a complex object from one frame to another

K

Konstantin Kudin

All,

I am trying to implement JavaScript that will remove a table row in frame
,
and append it to a table in frame
. The browser is IE6.

I've played with several approaches for quite a bit of time, but none of them seem
to work. The removed row does not seem to be able to go across the frame boundaries.

Here is the code in the target frame
that is invoked by a button in
frame
:

function move_all()
{
var parentElement = window.parent.tleft.document.getElementById("tbody_left");
var parentElement1 = window.parent.tleft.document.getElementById("tbody_left1");
var referencedMode = document.getElementById("tbody_right");
{
removedEl = parentElement.removeChild(parentElement.childNodes[0]);
var newtr = removedEl.cloneNode(true);
parentElement1.appendChild(newtr);
/* referencedMode.appendChild(newtr); - DOES NOT WORK ... */
parentElement1.appendChild(removedEl);
}
}

My attempt to append the newtr object to frame
returns "Invalid argument".
Appending the same thing to another table in frame
works just fine,
as well as appending the original removed row {removedEl} to that table.

Does anyone have any suggestions? How can I move a copy of a complex object
from one frame to another?

Thanks,
Konstantin​
 
M

Martin Honnen

Konstantin said:
All,

I am trying to implement JavaScript that will remove a table row in frame
,
and append it to a table in frame
. The browser is IE6.

I've played with several approaches for quite a bit of time, but none of them seem
to work. The removed row does not seem to be able to go across the frame boundaries.

Here is the code in the target frame
that is invoked by a button in
frame
:

function move_all()
{
var parentElement = window.parent.tleft.document.getElementById("tbody_left");
var parentElement1 = window.parent.tleft.document.getElementById("tbody_left1");
var referencedMode = document.getElementById("tbody_right");
{
removedEl = parentElement.removeChild(parentElement.childNodes[0]);
var newtr = removedEl.cloneNode(true);
parentElement1.appendChild(newtr);
/* referencedMode.appendChild(newtr); - DOES NOT WORK ... */
parentElement1.appendChild(removedEl);
}
}

My attempt to append the newtr object to frame
returns "Invalid argument".
Appending the same thing to another table in frame
works just fine,
as well as appending the original removed row {removedEl} to that table.

Does anyone have any suggestions? How can I move a copy of a complex object
from one frame to another?​


Unfortunately IE (at least IE5/5.5/6 on Win) doesn't support what the
W3C DOM Level 2 suggests for that, namely the method
importNode
see
http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document
So you would either write some importNode yourself or you would need to
use IE's DOM with copying the outerHTML of the elements using
insertAdjacentHTML​
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top