[thelist] appendChild() invalid for frame?

SBeam sbeam at syxyz.net
Thu Jun 19 06:56:25 CDT 2003


In trying to use the DOM to perform some acrobatics for a CMS, using 
cloneNode() and appendNode() to try to copy some default XHTML into a IFRAME:

<html> <body onload="initFrame()">
<div id="foo" style="display: none">this is some <em>foo</em> for you</div>
<iframe id="theFrame" width="310" height="100"></iframe>
 function initFrame() {
     var newNodes = document.getElementById('foo').cloneNode(true);
     newNodes.style.display = 'block';
     var idoc = document.getElementById('theFrame').contentWindow.document;

This works fine in Mozilla. IE6 says "Invalid Argument" at the appendChild() 
line. Have tried many permutations of replaceChild(), insertBefore(), etc. 
with the same result. It does work if the node I am appending to is in the 
same document (not in a separate frame)...

most of the hair on the sides of my head is gone now. Hoping someone has been 
down this road before.


More information about the thelist mailing list