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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing code for use with images ! 1

Status
Not open for further replies.

skint

Technical User
Mar 10, 2008
11
GB
Hi, i am a complete novice and have managed to use this code to load videos into a div on a page, make them invisable, and play each individual video on the player when clicked on via a picture link in the same page. It works fine, but now i need to change the code to do the same thing for showing just pictures
here's the code for the vids


<div id="selectqtvideo2" style="display: none">
<embed src="../media/Lake.mov" width="320" height="256"> </embed>
</div>


<div id="selectqtvideo3" style="display: none">
<embed src="../media/cam vid.mov" width="320" height="256"> </embed>
</div>


<div id='videoPlayback' style='width: 320px; height:256px; background-color: #2A0000;'></div>


<A HREF="../media/Lake.mov" onclick='return playVideo("selectqtvideo2","videoPlayback")'><img src="../raw images/vid 2.JPG" alt="vid 2" width="887" height="450" /></a>

<a href="../media/cam vid.mov" onclick='return playVideo("selectqtvideo3","videoPlayback")'><img src="../raw images/vid 3.JPG" alt="vid 3" width="781" height="456" /></a>




<script type="text/javascript">function playVideo(sourceId, targetId) { if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);} if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);} targetId.innerHTML=sourceId.innerHTML; return false;}</script>

It is all done in a layout table and i have not included the table stuff for ease. Just the important bits.

obviously i have to change the div id, the links to photos, the embed sources and the image sources, but i think i need to change something else in the java script to get it to work. and i don't know the function for images (or anything else for that matter). Do i change function playVideo for function viewImg or something like that ? Please could somebody point me in the right direction.

Thanks for any of your input !
 
As far as I can tell, all you need to replace are the two lines that say:
<embed src="../media/[..]" width="320" height="256"> </embed>
into something like:
<img src=... etc. />

and then alter the <a href...> likewise.

The name playVideo is just that, a name for the function. it could have been named anything at all but it has been given a descriptive name.

What the javascript function does is copy the content of the div selectqtvideo2 or selectqtvideo3 into the videoplayback div. In theory you can therefor put anything inside the first two divs and they will be displayed accodingly.

 
Thanks mate, i'll give it a go and post back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top