var myMusic = null; var MyMusic = function(){ var _this = this; var musicBox_H = document.getElementById("musicBox"); var music = "音乐播放器/images/music/"; //音乐列表 var musicFiles=[ new MusicObj("01诗篇23篇","/yinyue/有情天音乐/渴望/01诗篇23篇.mp3","有情天音乐",0,1), new MusicObj("02命定之路","/yinyue/有情天音乐/渴望/02命定之路.mp3","有情天音乐",0,1), new MusicObj("03渴望","/yinyue/有情天音乐/渴望/03渴望.mp3","有情天音乐",0,1), new MusicObj("04我们是一家","/yinyue/有情天音乐/渴望/04我们是一家.mp3","有情天音乐",0,1), new MusicObj("05神有他美意","/yinyue/有情天音乐/渴望/05神有他美意.mp3","有情天音乐",0,1), new MusicObj("06耶稣你是唯一","/yinyue/有情天音乐/渴望/06耶稣你是唯一.mp3","有情天音乐",0,1), new MusicObj("07呼求","/yinyue/有情天音乐/渴望/07呼求.mp3","有情天音乐",0,1), new MusicObj("08I Am Not Alone","/yinyue/有情天音乐/渴望/08I Am Not Alone.mp3","有情天音乐",0,1), new MusicObj("09回转归向你","/yinyue/有情天音乐/渴望/09回转归向你.mp3","有情天音乐",0,1), new MusicObj("10光芒","/yinyue/有情天音乐/渴望/10光芒.mp3","有情天音乐",0,1), new MusicObj("11我决心","/yinyue/有情天音乐/渴望/11我决心.mp3","有情天音乐",0,1), new MusicObj("12Deep","/yinyue/有情天音乐/渴望/12Deep.mp3","有情天音乐",0,1), new MusicObj("13我要爱你","/yinyue/有情天音乐/渴望/13我要爱你.mp3","有情天音乐",0,1), new MusicObj("14与我同行","/yinyue/有情天音乐/渴望/14与我同行.mp3","有情天音乐",0,1), ]; //播放模式 1-全部循环 2-单曲循环 3-随机播放 var playMode = 1; //当前音乐播放的下标 var index = -1; var length = musicFiles.length; var playMode_H = $("#playMode"); var musicList_H = $("#musicList"); var playMsg_H = $("#playMsg"); var name = $("#name"); var author = $("#author"); var CD = $("#CD"); var picInfo = $("#picInfo"); var pop =$("#pop"); var playMsg = null; _this.fristMusic = function(){ index = 0; _this.play(); } _this.playOrPause=function(){ pop.addClass("Gray"); var popVal = pop.attr("imgVal"); if(popVal == 0){ pop.attr("src","music/play.png"); pop.attr("title","点击播放"); pop.attr("imgVal","1"); musicBox_H.pause(); }else{ pop.attr("src","music/pause.png"); pop.attr("title","点击暂停"); pop.attr("imgVal","0"); musicBox_H.play(); } } _this.end = function(){ index = length -1; _this.play(); } _this.lastMusic = function(){ if(index == 0){ index = length-1; }else{ index --; } _this.play(); } _this.loadMusic = function(){ for(var i in musicFiles){ var html = "