piggy-backing on what kyle said, SWFObject uses document.getElementById to find the element that will be replaced by the <object> (in your case, the div named "placeholder").
i believe document.getElementById won't work on elements that haven't been added to the DOM yet, which means SWFObject won't be able to find the target element. (though i could be wrong!) On Mon, Jun 22, 2009 at 5:13 PM, Getify Solutions, Inc. <[email protected]>wrote: > > If you are executing that logic AFTER the DOM is already loaded and ready, > either embedSWF() or createSWF() will execute immediately and insert the > SWF > into the DOM. If you are executing that logic before DOM is ready, it's > potentially unsafe to replace the object (as SWFObject does) so that's why > we wait. > > You can of course create elements on the fly, as you are doing, to target > them for replacement. But SWFObject looks in the DOM for them, and if it > doesn't find them you're out of luck. So you can't really target SWFObject > against an item that is not yet in the DOM, as you are suggesting.m > > --Kyle > > > > > -------------------------------------------------- > From: "Bertrand" <[email protected]> > Sent: Monday, June 22, 2009 3:40 PM > To: "SWFObject" <[email protected]> > Subject: Embedding SWF into not yet inserted DOM node > > > > > Hi, > > > > I would like to know if it possible to do something like: > > > > var myElement = document.createElement('div'); > > myElement.setAttribute('id', 'placeholder'); > > swfobject.embedSWF(file, 'placeholder', .....); > > document.body.appendChild(myElement); > > > > That way I wouldn't have to wait for the element to be inserted into > > the DOM. > > > > Thanks a lot, > > > > Bertrand. > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/swfobject?hl=en -~----------~----~----~----~------~----~------~--~---
