Play Youtube videos On a Embedded Player Upon clicking Multiple hyperlinks

Hi guys… I am just starting to learn JavaScript. I wanted to know how to have multiple hyperlinks (Containing links to Youtube Videos) that when clicked, cause the corresponding videos to play on the Youtube Player Embedded on the site. I hope my question is not too confusing. Thank you in advance!

I saw some Source Code relating to this on StackOverflow and copied it and couldn’t get it to work… Here’s my source code.

<title> Sample Page </title>
// Get element holding the video (embed or object)
var player = document.getElementById("MOVIE");

//Create a simple function and check if player exists
function play() {
    if(player) {
<object width="420" height="315"><param name="MOVIE" value=";hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src=";hl=en_US" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<a href="" onclick="play()"> THIS IS FIRST Video Link </a></br></br>
<a href="" onclick="play()"> THIS IS SECOND Video Link </a>

Any Kind souls out there to help me? =) Or is my question unclear?

something like this?
if yes then just copy the source code thats all u need.

That was exactly what I was looking for! Thank you so much Sir! :slight_smile: