html js 控制点击一次按钮就播放一次音频,怎么弄,
<embedsrc=""width='0'height='0'type='audio/mpeg'autostart="true"id="snd"volume="10"/>...
<embed src="" width='0' height='0' type='audio/mpeg' autostart="true" id="snd" volume="10"/>function playSound(src){var _s = document.getElementById('snd');_s.outerHTML="<embed src='"+src+"' width='0' height='0' type='audio/mpeg' loop='false' autostart='true' id='snd'/>";}
<a href="javascript:playSound('012.mp3');">点击发声</a>可是只有ie有效,一年前,我在火狐,其他浏览器测试都行的啊,现在360极速没声音 展开
<a href="javascript:playSound('012.mp3');">点击发声</a>可是只有ie有效,一年前,我在火狐,其他浏览器测试都行的啊,现在360极速没声音 展开
展开全部
<script>
<!--\\
if(navigator.userAgent.indexOf("MSIE")!=-1)
{
document.write('<OBJECT classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="0" height="0" id="player">');
document.write('<param name="AutoStart" value="true"/>'); //控制声音是否自动播放
document.write('<param NAME="PlayCount" VALUE="99">');
document.write('<param name="URL" value="/templets/cloth/music/music.mp3"/>');
document.write('</OBJECT>');
}
else
{
document.write('<OBJECT type="application/x-ms-wmp" autostart="true" src="/templets/cloth/music/music.mp3" width="0" height="0" id="player">');
document.write('<param NAME="PlayCount" VALUE="99">');
document.write('</OBJECT>');
}
$(function(){
$("#music_button").toggle(function(){
document.all.player.controls.stop();
$(this).attr("src","/templets/cloth/images/music.jpg");
},function(){
document.all.player.controls.play();
$(this).attr("src","/templets/cloth/images/music.gif");
})
})
//-->
</script>
追问
自己搞定了,加多个html5的音频播放就OK了,谢谢你的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询