[javascript]代码库
audio id="myMusic" ></audio>
<div style="position: fixed;z-index: 99999;top:5px;left:0px;width:40px;height:40px;"><img id="musicstatus" src="http://weixin.0750sms.com/images/pause.png" width="40px" height="40px" /></div>
<script type="text/javascript">
$(document).ready(function(){
$("#musicstatus").click(function(){
if(musicstart==true){
m_stop();
musicstart=false;
}else{
m_play();
musicstart=true;
}
});
});
var musicstart=true;
var Control = function(o){
this.setting = (typeof o === 'object')? o : {};
this.audio = document.getElementById("myMusic");
this.init();
}
Control.prototype = {
//初始化
init:function(){
document.getElementById("myMusic").src = "{lanrain:$media['url']}";
document.getElementById("myMusic").play();
},
}
var myControl = new Control({
audio : document.getElementById("myMusic"), //播放器
});
function m_play(){
document.getElementById("myMusic").play();
$("#musicstatus").attr("src","http://weixin.0750sms.com/images/pause.png");
}
function m_stop(){
document.getElementById("myMusic").pause();
$("#musicstatus").attr("src","http://weixin.0750sms.com/images/play.png");
}
ZzxMusic();
// document.getElementById("myMusic").src = "{lanrain:$media['url']}";
// document.getElementById("myMusic").play();
</script>