so I got this function from someone, what it does is replace my image with an swf, or other html code after waiting 10 seconds, here it is.
<input name="sample_check3" id="sample_check3" value="1" type="radio" onclick="showStuff('stage');setTimeout(function() {$('#stage').html('HTML CODE HERE'); }, 10000)""/>
If I just put a simple html paragraph or heading in there, it successfully replaces the image with it, but when I try to put my swf code in there, it thinks that the swf embed code is HTML, and basically just “echos” it right away right where it is, instead of waiting. This is what i replaced it with.
<input name="sample_check3" id="sample_check3" value="1" type="radio" onclick="showStuff('stage');setTimeout(function() {$('#stage').html('<OBJECT style="z-index:2; position:absolute; top:20%; left:44%;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="rice" ALIGN="">
<PARAM NAME=movie VALUE="rice.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="rice.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="rice" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT>'); }, 10000)""/>
I have tried using single quotes, double quotes, esscaping the quotes, it all yields the sam result. It just places the swf right where it is with ); }, 10000)""/> printed out after it, because it basically forgets its javascript (not forgets, I just dont know how to explain it xD) Anyway, Im hoping someone could help me, thanks.
You have an extra
"at the end:If this is not the issue, we may need to see the html being set in
.html().Edit: I do not know how I missed your second example with the actual html yesterday. However, when looking at your html, I highly recommend that you do not do your javascript inline. You can take advantage of the power of jQuery and can setup your click handler like this:
HTML:
Javascript: