下一首
播放模式:
MusicBox=function (){
var _this=this;
var media= document.getElementById(\"musicBox\");
var musicFiles=[
{name:\"犯错
\
{name:\"天使的翅膀
\mp3\
{name:\"无名轻音乐
\
{name:\"草泥马之歌\//错误的资源
{name:\"相思风雨中\
];
//当前正在播放的歌曲的索引
var index=-1;
//当前正在播放的歌曲
var playingFile=null;
//播放模式
var playMode=1;
//下一首
this.nextMusic=function(){
if(playMode==\"1\"){
index+=1;
}
if(index==musicFiles.length){
index=0;
}
playingFile=musicFiles[index];
media.setAttribute(\"src\
media.play();
$(\"#ul_musicList\").children().css({\"background-color\":\"#FFF\color\":\"#000\
$( $(\"#ul_musicList\").children()[index]).css({\"background-color\":\"#2C7DE2\1px #206DDF\
}
//加载
this. loadStart=function(){
$(\"#sn_status\").text(\"加载中....\");
}
//播放
this. playing=function(){
$(\"#sn_status\").text(\"当前正在播放:\"+playingFile.name);
}
//暂停
this. pausePaly=function(){
$(\"#sn_status\").text(\"暂停:\"+playingFile.name);
}
//加载出错
this. loadError=function(){
$(\"#sn_status\").text(\"加载“\"+playingFile.name+\"”失败,可能资源不存在~\");
}
//初始化
this.init=function(){
for(var a in musicFiles){
$(\"#ul_musicList\").append(\"
}
_this.nextMusic();
$(\"#slt_playMode\").change(function(){
playMode=$(\"#slt_playMode\").val();
});
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容