当我的用户单击链接时,我希望更改源参数并将参数嵌入视频对象中,但我似乎无法显示新视频。参数中加载的默认视频可以正常工作,只是不确定如何才能加载新视频。这是我的脚本和 HTML。
<div id="videoPlayerDiv" style="height: 350px; width: 350px;">
<div id="videoTable">
<table>
<tr>
<td><b>Trading Videos</b></td>
</tr>
<tr>
<td>--></td><td><a href="#" onclick="playVideo('tradingOverview');">Trading Overview</a></td>
</tr>
<tr>
<td>--></td><td><a href="#" onclick="playVideo('multiAccount');">Multi-Account Trading Wizard</a></td>
</tr>
<tr>
<td>--></td><td><a href="#" onclick="playVideo('globalUnlock');">Global Unlock</a></td>
</tr>
</table>
</div>
<div id="videoPlayer" style="display:none; height: 250px; width: 250px;">
<object id="objViewer" width="250" height="250" type="video/x-ms-asf" data="Wildlife.wmv" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="Wildlife.wmv">
<param name="filename" VALUE="Wildlife.wmv">
<PARAM name="autostart" VALUE="0">
<param name="uiMode" value="full">
<param name="autosize" value="1">
<param name="playcount" value="1">
<EMBED TYPE="application/x-mplayer2" src="Wildlife.wmv" NAME="MediaPlayer" id="wmvViewer" autostart="false"
WIDTH="250" HEIGHT="250" ShowControls="1" ShowStatusBar="0" ShowDisplay="0">
</EMBED>
</OBJECT><br/>
<a onclick="returnVideos();">Return to Videos</a>
</div>
后跟代码;
function playVideo(x){
$("#videoTable").attr("style","display:none;");
$("#videoPlayer").attr("style","display:block;");
var videoToPlay = x;
switch(videoToPlay){
case 'tradingOverview':
//alert(videoToPlay);
var newElement = "Wildlife.wmv";
$("#wmvViewer").attr('src', newElement);
break;
case 'multiAccount':
//alert(videoToPlay);
var newElement = "BabyBoyMainBackground.wmv";
$("#wmvViewer").attr('src', newElement);
break;
case 'globalUnlock':
var newElement = "Panel_Mask.wmv";
$('#objViewer').find('embed').attr('url', newElement);
$('#objViewer').find('embed').attr('filename', newElement);
$("#wmvViewer").attr('src', newElement);
//alert(videoToPlay);
break;
}
}
function returnVideos(){
$("#videoTable").attr("style","display:block;");
$("#videoPlayer").attr("style","display:none;");
}
基本上在 switch 语句中,根据用户按下查看的视频,我想更改以下参数;
和
将所有这些值更改为声明的新视频文件。上面的不同情况是我尝试过的不同的事情,但没有任何效果。任何帮助将不胜感激。谢谢你们!