用js与css实现的网页音乐播放器,代码是潭州教育的,帮忙查下错
<!doctype html>
cloudmusic body{margin:0;} #music{width:1400px;height:860px;background:gray;margin:120px auto;border-radius:6px;overflow:hidden;box-shadow:0px 0px 8px #000000;opacity:0.9;} #music .m-left{width:1100px;height:800px;background:url("images/music.gif")center;float:left;} #music .m-right{width:300px;height:800px;background:#cc3333;float:right;} #music .m-right ul {width:150px;margin:40px auto;list-style:none;border-bottom:1px solid #c7d3cf;text-align:center;padding:0;} #music .m-right ul li:nth-child(2){line-height:40px;font-weight:700;font-family:"宋体";} #music .m-right ul
[ti:告白气球]
[ar:周杰伦]
[al:周杰伦的床边故事]
[offset:0]
<script> var lrc =$("#lrc").val(); //console.log(lrc) //对歌词分割 var lrcArr =lrc.split("["); var html=""; for(var i=0,len = lrcArr.length;i<len;i++){ var arr =lrcArr[i].split("]"); var timer = arr[0].split("."); var stimer = timer[0].split(":"); var ms = stimer[0]*60 + stimer[1]*1; var message =arr[1]; if(message){ html+=" <p id='"+ms+"'>"+message+"</p>"; } $(".text").html(html); } var flag = 0; $("#play").click(function(){ if(flag ==0){ $("#myMusic").get(0).play(); flag=1; }else{ $("#myMusic").get(0).pause(); flag=0; } }); $("#myMusic").get(0).addEventListener("timeupdate",function(){ var timer =this.currentTime; var s = parseInt(timer); for(var i=0;i<s;i++){ $("#"+i).addClass("color anmated swing").siblings().removeClass("color animated swing"); } $(".text").scrollTop(($(".color").index()-10)*25); }); </script>
繁花不似锦
Cats萌萌
相关分类