Here we just create a division to hold the video we want to play. (Feel completely free to modify or eliminate the style).
Code:
<div id='videoPlayback' style='width: 435px; height:350px;background-color: #800000;'></div>
Next we embed all the videos we want to be on the list, just like we did with the cancel only here we will add a small style to the division tag that will make the videos invisible. Remember, the id needs to be a unique name.
Code:
<div id='selectDemo1' style='display: none'>
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/-is63goeBgc"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/-is63goeBgc&autoplay=1"
type="application/x-shockwave-flash" wmode="transparent"
width="425" height="350">
</embed>
</object>
</div>
<div id='selectDemo2' style='display: none'>
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/c6SHsF1n9Qw"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/c6SHsF1n9Qw&autoplay=1"
type="application/x-shockwave-flash" wmode="transparent"
width="425" height="350">
</embed>
</object>
</div>
Then add a bunch of links which call a small Javascript function that will insert a copy of a hidden video into the playback division when the user clicks on a link.
Code:
<A HREF="#" onclick='returnplayVideo ("selectDemo1","videoPlayback")'>RvD2: Ryan vs. Dorkman 2</A><BR>
<A HREF="#" onclick='returnplayVideo ("selectDemo2","videoPlayback")'>Beatboxing Flute <q>Peter and the Wolf</q></A><BR>
finally let javascript do the work
Code:
<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>
Hope this sample helps you
Bookmarks