View Full Version : How to pass <table> back to parent

10-17-2002, 04:30 PM
I'm spawning a child window from a parent. In the child I'm dynamically building a table. When I click "finished" I want the entire table to go back to the parent and replace the original table "shell" (an empty <table> </table> tag-pair).

Note: The table ID is the same at the parent and child. This allows the replacement to work repeatedly. The child window closes but I don't see the table on the parent.

I get the feeling I'm mixing DHTML and DOM (ie "window.opener....") and .. well, I don't know what to think.

Is it OK to nest DOM functions as shown in the code?

I've tried a couple of different things - I'd like to use "replaceNode", but the syntax is not clear in the reference I have.

[b]The problem{/b]
Below is the function triggered by the child window "finished" button's onclick event.

I suspect the variable assignment is wrong as an alert box immediately after it (removed in this sample) did not show up.

function finished() {
var oldReport = window.opener.document.getElementbyId('DBReportsTable');
oldReport.firstChild.removeNode(true); // the <tbody>
return true;
} // finished()

10-17-2002, 07:14 PM
Couple things....

removeNode() is IE only. Should change to:


Also, is the TBODY really the firstChild? If you're browsing with Gecko, it could be a textNode.

Vladdy's kick*ss DOM Viewer (http://www.vladdy.net/WebDesign/DOM_TreeViewer.html) can help you determine this.

10-17-2002, 07:42 PM
Didn't realize removeNode (et.al.) is IE only. I don't recall the tutorial at Doc Javascript http://www.webreference.com/js/ saying it was IE unique.

Yes, the firstChild reference for tbody works. It just happens that tbody is the only child of table.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum