Bei onclick value="" Verweis ändern

son gohan

Erfahrenes Mitglied
Hallo,

geht folgendes überhaupt oder teste ich vergebens?

1.Javascript Funktion:

Code:
<script type="text/javascript">
//<![CDATA[
function setCSS () {
document.getElementById('tooltipp1id').value="http://www.youtube.com/v/mj1Fc2-rAls&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6";
document.getElementById('tooltipp1id2').src="http://www.youtube.com/v/mj1Fc2-rAls&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6";
}
//]]>
</script>

2. HTML Code:
HTML:
<object class="bilda1" width="164" height="120"><param name="movie" value="http://www.youtube.com/v/a-ePbjYtHp8&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6" id="tooltipp1id"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/a-ePbjYtHp8&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6" id="tooltipp1id2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="164" height="120"></embed></object>

<a href="#nogo" onclick="setCSS(); return false;">1</a>


Wenn man un auf den Link klickt soll im object Tag wo ein youtubevideo drine ist ein neues video geladen werden welches in der Javascript Funktion oben gespeichert ist.
 
Hi,

schon mal versucht, das Object-Element zu clonen, die Filmquellen zu ersetzen und das Orginal durch seinen Klon zu ersetzen?

Beispiel:
Code:
<html>
<head>
<title>www.tutorials.de</title>
<meta name="author" content="Quaese">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
  <!--
function setCSS () {
  // Object-Element ermitteln und clonden
  var objObj = document.getElementById("obj_01");
  var objClone = objObj.cloneNode(true);

  // Film-Wert ersetzen
  objClone.childNodes[0].value="http://www.youtube.com/v/mj1Fc2-rAls&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6";

  // Falls kein IE
  if(objClone.getElementsByTagName("embed")[0])
  	objClone.getElementsByTagName("embed")[0].src="http://www.youtube.com/v/mj1Fc2-rAls&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6";

  objObj.parentNode.replaceChild(objClone, objObj);
}
 //-->
</script>
</head>
<body>
<object id="obj_01" name="obj_01" class="bilda1" width="164" height="120" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
  <param name="movie" value="http://www.youtube.com/v/a-ePbjYtHp8&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6" id="tooltipp1id"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/a-ePbjYtHp8&hl=de_DE&fs=1&color1=0x006699&color2=0x54abd6" id="tooltipp1id2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="164" height="120"></embed>
</object>

<a href="#nogo" onclick="setCSS(); return false;">1</a>
</body>
</html>

Ciao
Quaese
 
Zurück