Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image to swf onclick

Status
Not open for further replies.

GiddyRob

Programmer
Aug 25, 2005
37
GB
Hi,

I was just wondering how I can have an image that when it is clicked it is replaced by a flash swf?

The problem I have been having is that I have embedded quite a lot of youtube videos on a webpage and it kills the computer trying to load them all. I would like it so that it only loads the embedded clip when the particular image is clicked on. I do not want to refresh the page as this will move back up to the top of the page so that the user can't see the video they wanted to watch without scrolling down and finding it.

Any help would be great.

Cheers

Rob
 
[1] Like this for a start.
[tt] <div id="divid"><img src="abc.gif" alt="abc.gif" onclick="doit()" /></div>
[/tt]
[2] With the function doit() like this.
[tt]
function doit() {
var s;
s='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
'codebase=" 'WIDTH="400"\n'+
'HEIGHT="250"\n'+
'id="your_id"\n' +
'ALIGN="">\n' +
'<PARAM NAME=movie VALUE="[red]xyz.swf?someparam=somevalue_etc[/red]">\n' +
'<PARAM NAME=quality VALUE=high>\n' +
'<PARAM NAME=bgcolor VALUE=#bbbbbb>\n' +
'\n' +
'<EMBED src="[red]xyz.swf?someparam=somevalue_etc[/red]"\n' +
'quality=high\n'+
'bgcolor=#bbbbbb\n'+
'WIDTH="400"\n'+
'HEIGHT="250"\n' +
'NAME="your_name"\n'+
'ALIGN=""\n' +
'swLiveConnect="true"\n'+
'TYPE="application/x-shockwave-flash"\n'+
'PLUGINSPAGE=" +
'</EMBED>\n' +
'</OBJECT>'
document.getElementById("divid").innerHTML=s;
}
[/tt]
Format better to make it look better and with proper parameters fed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top