[SWFObject] Removing the SWFObject Element

Jonathan Spooner jspooner at aviatech.com
Wed Jun 21 16:22:00 PDT 2006


Thanks for SWFObject.  It rocks.

I'm trying to find a way to remove the SWF from my page with  
JavaScript.  I have
this destroy function that works in MSIE but crashes all other browsers.

I was wondering if there was a method open in SWFObject to remove the  
Element?
It would be sweet it there was a method like so.destroy();

Thanks,
Jonathan Spooner


	<div id="flashIntro"></div>

	<script type="text/javascript">
		// <![CDATA[

		function destroy() {
			var elem = document.getElementById("flashIntro");
			elem.parentNode.removeChild(elem);
		}

		var introSWF = new SWFObject("/swf/DH_intro_2.swf", "intro",  
"100%", "100%", "8");
		introSWF.addParam("scale", "noscale");
		introSWF.addParam("wmode","transparent");
		introSWF.write("flashIntro");
		// ]]>
	</script>



More information about the Swfobject mailing list