当前位置: 代码迷 >> Web前端 >> 网页音乐播发
  详细解决方案

网页音乐播发

热度:281   发布时间:2012-08-27 21:21:56.0
网页音乐播放
<embed src="<%=path%>/web/flash/mzdhl.mp3" id="mp" align="center"
border="0" style="height:0px;width:0px;" autostart="true" loop="true">

<script type="text/javascript">
var musicState = 1;
function music() {
if (musicState == 1) {
document.getElementById("mp").pause();
musicState = 2;
document.getElementById("player").src="<%=path %>/web/img/play_24.png";
document.getElementById("player").title="背景音乐播放";
} else {
document.getElementById("mp").play();
musicState = 1;
document.getElementById("player").src="<%=path %>/web/img/stop_24.png";
document.getElementById("player").title="背景音乐暂停";
}
}
</script>
  相关解决方案