站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Javascript 专题推荐:三种不错的网页播放器代码

推荐:三种不错的网页播放器代码

摘要: 推荐:三种不错的网页播放器代码
<tr> <td>

<textarea class=fm id=code1 style="WIDTH: 529px; HEIGHT: 174px" rows=12 cols=84> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> 在线音乐点播</td> </tr> </table>
<table align=center style="font:9pt"> <tr> <td>
查看当前任务
MP3点播
轩辕剑参外传-天之痕 张真(红红好姑娘)
播放速度调整 <script> var mediaRate=document.MediaPlayer1.Rate; var mediaVolume=document.MediaPlayer1.Volume; var mediaCurrentPosition=document.MediaPlayer1.CurrentPosition; function setRate(num) { mediaRate=num; document.MediaPlayer1.Rate=num; } function addCurrentPosition(num) { mediaCurrentPosition=document.MediaPlayer1.CurrentPosition; mediaCurrentPosition+=num; if(mediaCurrentPosition<0)mediaCurrentPosition=0; document.MediaPlayer1.CurrentPosition=mediaCurrentPosition; } function addVolume(num) { mediaVolume=document.MediaPlayer1.Volume; if(num>0 && mediaVolume<-1) { mediaVolume+=num; if(mediaVolume>-1)mediaVolume=-1; document.MediaPlayer1.Volume=mediaVolume; } else { if(num<0 && mediaVolume>-9999) { mediaVolume +=num; if(mediaVolume <-9999)mediaVolume=-9999; document.MediaPlayer1.Volume=mediaVolume; } } } function addRate(num) { mediaRate=document.MediaPlayer1.Rate; if(num>0 && mediaRate<12.0) { mediaRate+=num; //if(mediaRate >2.0)mediaRate=2.0; document.MediaPlayer1.Rate=mediaRate; } else { if(num<0 && mediaRate>0.1) { mediaRate +=num; if(mediaRate <0.1)mediaRate=0.1; document.MediaPlayer1.Rate=mediaRate; } } } function exchangeValue(obj) { if(obj=="0") { obj="-1"; } else { obj="0"; } return obj; } </script> 速度慢0.0较快 加速 减速 较慢 正常 查看速度
播放声音调整 静音/取消 查看
最大 最小 默认 中大 中等 中小 加大音量 减少音量 查看
播放界面控制
显示/隐藏字幕 查看
显示/隐藏播放控制 查看
显示/隐藏音量控制 查看
显示/隐藏节日信息 查看
显示/隐藏GOTOBAR 查看
显示/隐藏位置控制 查看
显示/隐藏播放信息 查看
显示/隐藏播放跟踪条 查看
声道切换 左声道 右声道 左右平衡 查看
视频窗口大小 50% 100% 200% 全屏 查看
播放进度控制 回到开始 前进一分钟 后退一分钟 到最后 查看
选择伴音 天之痕 查看 (注意不能马上生效,点击后需要再重新播放歌曲) 查看 <script language=vbscript> for each obj in document.MediaPlayer1.all messagebox(obj) next </script> </td></tr></table></textarea>

<input style="CURSOR: hand" onfocus=this.blur() onclick="runEx('code1')" type=button value=运行代码> <input style="WIDTH: 95px; CURSOR: hand" onfocus=this.blur() onclick=cycode(code1) type=button value=复制到剪贴板 name=Submit> <input style="CURSOR: hand" onfocus=this.blur() onclick=svcode(code1) type=button value=另存代码> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

<textarea class=fm id=code2 style="WIDTH: 521px; HEIGHT: 174px" rows=12 cols=82> <head> aboutplayer <script> function playList_dragOver(){ event.returnValue=false; } function playList_dragEnter(){ event.returnValue=false; event.dataTransfer.dropEffect='link'; } function addMusic(){ if(event.srcElement.tagName=='A'){ strTxt=event.srcElement.innerText; strURL=event.srcElement.href; playList.innerHTML=""; playList.options[0]=new Option(strTxt,strURL); playList.options[0].selected=true; } event.returnValue=false; playList_dblClick(); return(false); } function playList_drop(){ strTxt=unescape(event.dataTransfer.getData('Text').split(":")[0]); strURL=unescape(event.dataTransfer.getData('Text').split(":")[1]); playList.options[playList.options.length]=new Option(strTxt,strURL); } function playList_keyDown(){ if(event.keyCode==46){ try{ playList.options[playList.options.selectedIndex].outerHTML=""; }catch(e){} return(false); } if(event.keyCode==13){ playList_dblClick(); return(false); } } function playList_dblClick(){ MediaPlayer1.detachEvent("PlayStateChange",checkPlayStatus); MediaPlayer1.fileName=playList.value; MediaPlayer1.play(); setTimeout('MediaPlayer1.play();MediaPlayer1.attachEvent("PlayStateChange",checkPlayStatus);',1000); } function musicList_dragStart(){ if(event.srcElement.tagName=='A'){ event.dataTransfer.setData('Text',escape(event.srcElement.innerText)+":"+escape(event.srcElement.href)); }else{ return(false); } } function init(){ MediaPlayer1.AutoRewind=false; MediaPlayer1.AutoStart=true; MediaPlayer1.SendPlayStateChangeEvents=true; MediaPlayer1.attachEvent("PlayStateChange",checkPlayStatus); } function checkPlayStatus(oldState,newState){ try{ if(MediaPlayer1.PlayState==0){ MediaPlayer1.detachEvent("PlayStateChange",checkPlayStatus); MediaPlayer1.stop(); if(playList.options.selectedIndex<body onload="init();"> <table id=table01> <tr> <td> </td> <td>

Play List:
<select id=playList size=2 ondragover="playList_dragOver();" ondragenter="playList_dragEnter();" ondrop="playList_drop();" onkeydown="playList_keyDown();" ondblclick="playList_dblClick();"> </select> </td> </tr> </table> <script language="JavaScript1.2"> var dragswitch=0 var nsx var nsy var nstemp function drag_dropns(name){ temp=eval(name) temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP) temp.onmousedown=gons temp.onmousemove=dragns temp.onmouseup=stopns } function gons(e){ temp.captureEvents(Event.MOUSEMOVE) nsx=e.x nsy=e.y } function dragns(e){ if (dragswitch==1){ temp.moveBy(e.x-nsx,e.y-nsy) return false } } function stopns(){ temp.releaseEvents(Event.MOUSEMOVE) } //drag drop function for IE 4+//// ///////////////////////////////// var dragapproved=false function drag_dropie(){ if (dragapproved==true){ document.all.showimage.style.pixelLeft=tempx+event.clientX-iex document.all.showimage.style.pixelTop=tempy+event.clientY-iey return false } } function initializedragie(){ iex=event.clientX iey=event.clientY tempx=showimage.style.pixelLeft tempy=showimage.style.pixelTop dragapproved=true document.onmousemove=drag_dropie } if (document.all){ document.onmouseup=new Function("dragapproved=false") } ////drag drop functions end here////// function hidebox(){ if (document.all) showimage.style.visibility="hidden" else if (document.layers) document.showimage.visibility="hide" } </script>
<table border="0" width="199" cellspacing="0" cellpadding="0"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0" height="36"> <tr> <td width="100%" bgcolor="#C6FFC6" style="padding:4px" onMousedown="initializedragie()">
用鼠标按着我拖拖看^o^
</td> <td bgcolor="#00CCFF" style="cursor:hand">×</td> </tr> <tr> <td width="100%" style="padding:4px" colspan="2">
All Music
麻吉弟弟 甜蜜蜜
第一滴泪 - 动力火车
半糖主义 - SHE
发如雪 - 周杰伦


Tips: 把歌曲拖入播放列表
<input type="button" class="style2" onclick="doFull();" value="全屏/ESC返回">
</td> </tr> </table> </td> </tr> </table>
<body> </textarea>

<input style="CURSOR: hand" onfocus=this.blur() onclick="runEx('code2')" type=button value=运行代码> <input style="WIDTH: 95px; CURSOR: hand" onfocus=this.blur() onclick=cycode(code2) type=button value=复制到剪贴板 name=Submit> <input style="CURSOR: hand" onfocus=this.blur() onclick=svcode(code2) type=button value=另存代码> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

<textarea class=fm id=code3 style="WIDTH: 523px; HEIGHT: 174px" rows=12 cols=83> <body>

</body> <script> window.onerror=function(){return false} start() function start(){ browser_ini() timer_ini() emv_ini() lrc.setData(oo("xLyric").innerHTML) lrc.write("歌曲载入中,请耐心等待...","l") emv.play("mms://218.66.102.192/mp3/2005-01-06/fea30a20-e49f-4ebc-8f25-44cfe4830ca7.wma") } function emv_ini(){ var l window.emv={} lrc_ini() l="
" l+="
" l+="
" l+="
" l+="
" l+="" insHtm(document.body,l) emv.play=function(url){oo("mplayer").FileName=url;oo("mplayer").Play()} emv.time=function(){ var mPos=mplayer.CurrentPosition,n=lrc.i var n1,o,len,w,per,n0,n1 n1=n=0){ n0=lrc.arr[n].slice(0,"|") n1=lrc.arr.length>n+1?lrc.arr[n+1].slice(0,"|"):4 o=oo("bxCaption_"+(n%2==0?"l":"r")+"_cover") len=o.time!=""?o.time*1:n1-n0 per=(mPos-n0)/len for(i=0.001;i<1;i+=0.001){ per1=lrc.getRealPos(o,i) if(per1>=per) break } o.style.width=o.width*i } } timer.add("emv.time()") } function lrc_ini(){ window.lrc={} lrc.wordPer=function(str,pos){ return str.slice(0,pos).replace(/[^\x00-\xff]/g," ").length/str.replace(/[^\x00-\xff]/g," ").length } lrc.setData=function(str){ var l,a,i,ad,n,j str=str.replace(/\|/g,"").replace(/\r\n/g,"\n") str=str.replace(/\[(\d\d)\:(\d\d)\.(\d\d)\]/g,function($0,$1,$2,$3){return ($1*60+$2*1+$3/100)+"|"}) a=str.split("\n") lrc.arr=new Array() for(i=0;iad[0]&&pos<=ad[1]) pos1+=(zoom*ad[2]-zoom)*(pos-ad[0]) else{ pos1+=(zoom*ad[2]-zoom)*(ad[1]-ad[0]) } } return pos1 } lrc.write=function(str,pos){ var word=str,style="" var x,y,l,w,w1,o,a,i,ad if(/^\<.+\>/.test(str)){ word=str.slice(">") style=str.slice(1).slice(0,">") } w=word.replace(/[^\x00-\xff]/g," ").length*13+2 if(pos=="l"){ x=40 y=285 } else{ x=520-w y=315 } l="
" l+="" l+="" l+="" l+="" l+="
" l+="
" l+="" l+="" l+="" l+="" l+="
" odel("bxCaption_"+pos) odel("bxCaption_"+pos+"_cover") insHtm("bxEmvScreen",l) o=oo("bxCaption_"+pos+"_cover") o.time=style.get("time") o.path=new Array() len1=1 a=style.split(";") for(i=0;i0 window.isIE5=navigator.userAgent.indexOf("IE 5.0")>0 String.prototype.trim=function(){return this.replace(/(^[\s]*)|([\s]*$)/g,"")} String.prototype.inc=function(s1,s2){if(s2==null){s2=","};return (s2+this+s2).indexOf(s2+s1+s2)>-1?true:false} String.prototype._slice="".slice String.prototype.slice=function(n1,n2){var v,b1=typeof(n1)=="number",b2=typeof(n2)=="number";if(!b1||typeof(n2)=="string"){v=eval("this._slice("+(b1?n1:this.indexOf(n1)+(n2==null?1:0)+(this.indexOf(n1)==-1?this.length:0))+(n2==null?"":(b2?n2:(this.indexOf(n2)==-1?"":","+this.indexOf(n2))))+")")}else{v=isIE5&&n1<0&&n2==null?this._slice(this.length-1):eval("this._slice(n1"+(n2==null?"":","+n2)+")")}return v} String.prototype.get=function(str,def){if(this.inc(str,";"))return 1;var a=this.match(new RegExp("(^|;)"+str+":[^;]*"));return a==null||str==""?(def==null?"":def):a[0].replace(";","").slice(str.length+1)} Array.prototype.add=function(key){this[this.length]=key} window.oo=function(obj){return typeof(obj)=="string"?document.getElementById(obj):obj} window.insHtm=function(op,html,inEnd){op=oo(op);if(isIE){op.insertAdjacentHTML(inEnd==null?"beforeend":"afterbegin",html)}else{var r=op.ownerDocument.createRange();r.setStartBefore(op);eval("op."+(inEnd==null?"appendChild":"insertBefore")+"(r.createContextualFragment(html),op.firstChild)");}} window.odel=function(obj){if(oo(obj)!=null){oo(obj).parentNode.removeChild(oo(obj))}} if(!isIE){ HTMLElement.prototype.contains=function(node){if(!node)return false;do if(node==this){return true}while(node=node.parentNode){return false}} Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1){node=node.parentNode}return node}) Event.prototype.__defineGetter__("toElement",function(){return this.relatedTarget}) } } function timer_ini(){ window.timer={} timer.handle=null timer.queue="" timer.i=0 timer.add=function(key){if(!timer.queue.inc(key,";")){timer.queue+=key+";"}} timer.del=function(key){timer.queue=move.queue.replace(key+";","")} timer.inv=function(){ window.clearTimeout(timer.handle) eval(timer.queue) timer.i++ timer.handle=window.setTimeout("timer.inv()",10) } timer.inv() } function sortFoo(v1,v2){ var s1=v1.split("|")[sortIndex],s2=v2.split("|")[sortIndex] if(!isNaN(s1)&&!isNaN(s2)){ s1*=1 s2*=1 } return (s1==s2?0:(s1>s2?1:-1))*sortDir } </script></textarea>

<input style="CURSOR: hand" onfocus=this.blur() onclick="runEx('code3')" type=button value=运行代码> <input style="WIDTH: 95px; CURSOR: hand" onfocus=this.blur() onclick=cycode(code3) type=button value=复制到剪贴板 name=Submit> <input style="CURSOR: hand" onfocus=this.blur() onclick=svcode(code3) type=button value=另存代码> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

</td> </tr> </table>
↑返回目录
前一篇: 显示客户端页面执行时间的代码
后一篇: 网页制作应掌握技术:随心所欲定制页面"弹出窗口"