I have just begun to learn JS. I am trying to change the value of embed src in the tag present in my HTML code. But am unable to do so with the following code I\'ve written
It may depend on the browser and the type of the embedded object, how you have to change the object(for example there are special methods for flash-movies like Play() , but the object isn't a flash-movie at the begin)
A common way is to replace the whole embed-node with a new :
function showGame(whichgame){
var source=whichgame.getAttribute("href");
var game=document.getElementById("gameHolder");
var clone=game.cloneNode(true);
clone.setAttribute('src',source);
game.parentNode.replaceChild(clone,game)
}