I am trying to embed a player in a website and I want to change the video by clicking on the images below the player.
Following code is working fine in Firefox but I am getting an error in IE 7: "getElementById(..) is null or not an object."
Can somebody tell me what I am missing here:
Code: Select all
<script type="text/javascript" language="javascript">
function MoveNextMovie(filePath, layerName){
document.getElementById(layerName).innerHTML='<EMBED TYPE="application/x-mplayer2" src="'+filePath+'" NAME="MediaPlayer" id="MediaPlayer" WIDTH="325" HEIGHT="280">';
}
</script>
<table width="325" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="325" valign="top" align="left"><OBJECT id="MediaPlayer" width=325 height=280 classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components…" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"><PARAM NAME="FileName" value="http://www.spongetech.com/images/Complete.wmv"><param name="Showcontrols" value="True"><param name="autoStart" value="True"><PARAM name="wmode" value="opaque"><PARAM name="ShowDisplay" VALUE="false"><div id="videowrapper"><EMBED TYPE="application/x-mplayer2" src="http://www.spongetech.com/images/Complete.wmv" NAME="MediaPlayer" id="MediaPlayer" WIDTH="325" HEIGHT="280"></div></EMBED></OBJECT></td></tr>
<tr>
<td valign="top" align="left">
<table width="325" border="0">
<tbody>
<tr>
<td>
<img src="images/demo.gif" alt="Demovideos" width="73" height="15" border="0" />
<a href="#" onclick='MoveNextMovie("http://www.spongetech.com/images/Complete.wmv", "videowrapper")'><img src="images/car_s.gif" alt="" width="72" height="15" border="0" /></a>
<a href="#" onclick='MoveNextMovie("http://www.spongetech.com/images/PetSponge.wmv", "videowrapper")'><img src="images/pet.gif" alt="" width="72" height="15" border="0" /></a><br />
<img src="images/bal.gif" alt="Balancing Act Videos" width="110" height="15" border="0" />
<a href="#" onclick='MoveNextMovie("http://www.spongetech.com/videos/BalancingAct_CarSponge.wmv", "videowrapper")'><img src="images/car_s.gif" alt="" width="72" height="15" border="0" /></a>
<a href="#" onclick='MoveNextMovie("http://www.spongetech.com/videos/BalancingAct_PetSponge.wmv", "videowrapper")'><img src="images/pet.gif" alt="" width="72" height="15" border="0" /></a>
<a href="#" onclick='MoveNextMovie("http://www.spongetech.com/images/Complete.wmv", "videowrapper")'><img src="images/pud.gif" alt="" width="87" height="15" border="0" /></a>
</td>
<td> </td>
<td><a onClick="javascript: window.open('http://s245656731.onlinehome.us/video.php?video=buyscot', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550'); return false" href="http://s245656731.onlinehome.us/#"><br />
</a></td>
<td><a onClick="javascript: window.open('http://s245656731.onlinehome.us/video.php?video=district', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550'); return false" href="http://s245656731.onlinehome.us/#"><br />
</a></td></tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left"> </td>
</tr>
</tbody>
</table>
Waqas