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
Link to comment
Share on other sites

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,
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.