[SWFObject] How do I dynamically remove swfobject usingjavascript
Terry Cali
swfobject-deconceptcom at dedicatedmanagers.com
Thu Sep 7 12:04:04 PDT 2006
Thanks. A couple more questions if you don't mind....
1) I saw the innerHTML thing you did and just wrote this on the original DV tag, which worked:
document.getElementById("mySWFobjectDIVcontainer").innerHTML="Hello World!";
Any reason to go the step further and create a new div and swap them out?
2) This isn't exaclty SWFobject related, but I could use some help....
What I'd actually like to replace the SWFobject with is a preloaded image. Any help on doing so?
// done in the head somewhere to preload image:
var myImage = new Image();
myImage.src = "http://mysite.com/images/image.jpg";
// swap SWF for image
document.getElementById("mySWFobjectDIVcontainer").innerHTML=<img src=myImage.src>; // doesn't work
or
// swap SWF for image
document.getElementById("mySWFobjectDIVcontainer").innerHTML=<img src="http://mysite.com/images/image.jpg">; // doesn't use preload in IE
----- Original Message -----
From: John Giotta
To: swfobject at lists.deconcept.com
Sent: Thursday, September 07, 2006 12:13 PM
Subject: Re: [SWFObject] How do I dynamically remove swfobject usingjavascript
I suggest doing a DOMElement.replaceChild.
// Somthing like
function removeSWFobject() {
var newdiv = document.createElement("div");
newdiv.innerHTML = "Hello World!";
var flashdiv = document.getElementById("mySWFobjectDIVcontainer");
document.body.replaceChild(newdiv, flashdiv);
}
Of course it does not destroy the SWFObject declared in JavaScript memory, it only removes the HTML rendered output.
------------------------------------------------------------------------------
_______________________________________________
SWFObject mailing list
SWFObject at lists.deconcept.com
http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060907/77ddfc51/attachment-0001.htm>
More information about the Swfobject
mailing list