<OBJECT ID="aboutplayer" CLASSID="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" height=150 width=200><param name="UIMode" value="none"></OBJECT>
<table height=100 width=200 border=3 bordercolor=blue>
<tr align=center>
<td bgcolor=white><font color=olive size=2>SMI 演示</font></td>
</tr>
<tr height=75>
<td bgcolor="green"><div id=CapText></div></td>
</tr>
</table>
<table width=200>
<tr>
<td align=center><INPUT TYPE="BUTTON" value="Play" onClick="Play()"></td>
<td align=center><INPUT TYPE="BUTTON" value="Stop" onClick="Stop()"></td>
</tr>
</table>
<script>
function Play()
{
aboutplayer.closedCaption.CaptioningID = "CapText";
aboutplayer.closedCaption.SAMIFileName = "http://lrc.aboutplayer.com/goodbye.smi";;
aboutplayer.URL = "http://www.111cn.net/wma/g00146001/g0014600101.wma";;
aboutplayer.controls.play();
}
function Stop()
{
aboutplayer.controls.stop();
}
</script>
问题的关键就是下面三句:
aboutplayer.closedCaption.CaptioningID = "CapText";
// 网页上显示歌词的位置 ID
aboutplayer.closedCaption.SAMIFileName = http://lrc.aboutplayer.com/goodbye.smi;
// SMI 歌词文件地址
aboutplayer.URL = http://www.111cn.net/wma/g00146001/g0014600101.wma;
// 媒体文件地址
放在 aboutplayer.controls.play(); 的前面。其中 SMI 文件地址最好用绝对地址(随媒体文件地址是绝对、相对而变化)。若媒体文件与 SMI 文件通名同路径,则 SMI 文件地址可省略不写。