View Full Version : DOM appendChild() fails for OBJECT and EMBED
cyzsuraj
12-17-2002, 07:16 AM
I am unable to append an EMBED element (embedObj) to an OBJECT element (flashObj) at the last line:
var flashObj = document.createElement("object");
var embedObj = document.createElement("embed");
flashObj.appendChild(embedObj);
Any ideas?
glenngv
12-17-2002, 07:29 AM
What does the error say? Can you also put the page online?
cyzsuraj
12-17-2002, 07:45 AM
The error states "Invalid argument", referring to the embedObj.
I tried to change the element types from OBJECT and EMBED to DIV and P, and it worked fine. It seems to be a nesting problem when using appendChild() with OBJECT and EMBED elements.
Here is the online page: http://suraj.ods.org/fobzlife/jukebox/js_index1.php
brothercake
12-18-2002, 03:16 AM
If memory serves .... OBJECT and EMBED are EMPTY, ie they can't have children. That's why you can't append nodes to them.
cyzsuraj
12-18-2002, 03:32 AM
Thanks, that is most likely the case.
I was trying to nest the EMBED and OBJECT because that's the way Macromedia wants people to write html code for a flash object. I guess I'll just have to use those elements seperately.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.