Swap Image from jpg to swf

Is there a javascript function to replace still image (jpg) with movie (swf)? If there is an unrelated swap image path?

+1


source to share


2 answers


You can do something like this:



<div id="still_image" style="display:block">
    <!-- img code here -->
</div>


<div id="ani_swf" style="display:none">
    <!-- embedded swf here -->
</div>

<input type="button" value="Swap" onclick="imgToSWF();" />

<script type="text/javascript">

function imgToSWF() {
    document.getElementById('still_image').style.display = 'none';
    document.getElementById('ani_swf').style.display = 'block';
}

</script>

      

+3


source


You can use swfobject . Of course, you haven't talked too much about what you really want to do: on mouseover, on page load (and the image will only be a replacement), etc ...



0


source







All Articles