I am trying to display some html embedding a SWF object using javascript.
The script works fine without the SWF object. Howevever, when the object is included in the html inserted into the div the script no longer runs.
If anyone can suggest fix or spot error, I would greatly appreciate it.
Here is jsfiddle.
Code (same as jsfiddle):
html:
<a href="javascript:void(0)" onclick="takeProfilePic('0');">Show Flash</a>
<a href="javascript:void(0)" onclick="takeProfilePic('1');">Do not show flash</a>
<tr><td colspan=2 align="center"><div id="takepic"></div>
javascript:
function takeProfilePic(type) {
// alert(type);
if (type==0)
{
var target = 'takepic';
var photo = '<tr><td colspan=2 align="center">hello</td></tr>';
document.getElementById(target).innerHTML = photo;
return false;
}
else if (type==1) {
var target = 'takepic';
var photo = '<tr><td colspan=2 align="center"><a href="stepthree.php"><img src="images/collapse.gif" border=0></a></td></tr><tr><td colspan=2 align="center">NO FLASH OBJECT HERE</td></tr>';
document.getElementById(target).innerHTML = photo;
return false;
}
}
Use
EMBED
tag instead ofOBJECT
tag.