On Thursday 21 August 2003 00:54, Richard Keene wrote:
I want to take one document called layout.html and another called body.html
and take the main contents node (a div with id='mainContents') and
remove it from the
instance of bodyHTML.class and replace the div in an instance of
layoutHTML.class
with the removed div.
I have code like....
layoutHTML L = new layoutHTML();
bodyHTML t = new bodyHTML();
// The div I want to replace.
HTMLElement centerMiddle = L.getElementCenterMiddle();
// The div I want to plug into the layoutHTML object.
HTMLElement indexMainContents = t.getElementMainContents();
HTMLElement nE =
(HTMLEelemet.getDocument().importNode(t.getElementMainContents(),true);
cenerMiddle.appendChild(newElement);
bodyMainContents.getParentNode().removeChild(indexMainContents);
centerMiddle.appendChild(t.getElementMainContents());
It compiles and when I run it it says 'wrong document'
It appears that the indexMainContents retains the class id or something
of the
owning document t, and so when L goes to render it'sself to the browser
it recognizes that the nodes are from the wrong doc.
Try someting like those two lines above.