Jump to content


Photo

Javascript swap image for flash files help


  • Please log in to reply
1 reply to this topic

#1 ace01

ace01
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 20 July 2006 - 01:30 PM

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


#2 GBS

GBS
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 26 July 2006 - 12:26 PM

Hi,

Try something like this:
<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>

Hoping it helps,,

l8tr,
Sorry for my english,... I do my best, but sometimes,...
1st intention: understand the problem
2nd intention: try to solve it
3rd intention: try to understand how to solve it :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users