Jump to content

Javascript swap image for flash files help


ace01

Recommended Posts

Hi,

I have been using a javascript that allows me to swap images for a image gallery.  Now I would like to do the samething, but I want to swap out flash files instead of images.

can i change just a few things with this code to make it work with flash files?

here is what i use to swap out images for my image gallery.

//in the head tag
<script language="JavaScript">

function ChangePicture(imgSrc)
{
document.large_picture.src=imgSrc;
}

</script>

//in the body
<a href="javascript:ChangePicture('inter_gen_event/01.jpg');">01</a>

thanks
Dave
Hi,

Try something like this:
[code]
<html>
<body>

<script language="JavaScript">

function ChangePicture(imgSrc)
{
var new_contains="<img id=\"large_picture\">";
document.getElementById('contains').innerHTML=new_contains;
document.getElementById('large_picture').src=imgSrc;
}

function ChangeFlash(flashSrc)
{
var to_embed="<embed src=\""+flashSrc+"\" quality=\"high\" bgcolor=\"black\" align=\"center\" width=\"296\" height=\"110\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>'";
document.getElementById('contains').innerHTML=to_embed;
}

</script>

changing images,,
<a href="javascript:ChangePicture('pics/flora10.jpg');">01</a>
<a href="javascript:ChangePicture('pics/flora9.jpg');">02</a>

& flash files:
<a href="javascript:ChangeFlash('bdm_player.swf');">03</a>

<div id="contains">
<img id="large_picture" src="pics/flora9.jpg">
</div>

</body>
</html>
[/code]

Hoping it helps,,

l8tr,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.