这里 MediaPlayer 是通过 其所在层的切换来控制 音乐的播放与否的!
?
下面是js代码:
?
<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" > function playmus(filepath){ $("#mus_play").hide(); window.setTimeout(function (){ $("embed").attr("src",filepath); $("#mus_play").show(); }, 100); } </script>
?
?
下面是html中音乐列表的代码:(注意这里要使用绝对路径,当然 网站路径也可以,但是相对路径不可以【?】!未知)
?
<a href="javascript:playmus('E:/1.mp3');">11111</a>
<br/>
<a href="javascript:playmus('E:/2.mp3');">222222</a>
<br/>
<a href="javascript:playmus('E:/1.mp3');">333333333</a>
<br/>
<a href="javascript:playmus('E:/4.mp3');">14444444</a>
<br/>
<br/>
<a href="javascript:playmus('E:/2.mp3');">222222</a>
<br/>
<a href="javascript:playmus('E:/1.mp3');">333333333</a>
<br/>
<a href="javascript:playmus('E:/4.mp3');">14444444</a>
<br/>
?
?
MediaPlayer 的播放代码,同样放到html中:
?
<div style="display: none;" id="mus_play"> <embed src="E:/1.mp3" border="0" width="230" height="68" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&" name="MediaPlayer" showcontrols="1" showpositioncontrols="0" loop="true" showaudiocontrols="1" showtracker="1" showdisplay="0" showstatusbar="1" autosize="0" showgotobar="0" showcaptioning="0" autostart="1" autorewind="0" animationatstart="0" transparentatstart="0" allowscan="1" enablecontextmenu="1" clicktoplay="0" invokeurls="1" defaultframe="datawindow"> </embed> </div>
?
?
转载请注明出处:http://nilm61.iteye.com/admin/blogs/1225179/edit
?
?
?
www.ibuyincn.com
?