比较吃力的地方是drop到播放列表,查MSDN查了n久,还有WindowMediaPlayer6.x插件的play有些奇怪,所以我的代码也有些奇怪........
拜托各位多测测,有Bug您说话,看我做的也挺不容易的,觉得好的您也多捧捧场。
My HTML Player body { overflow:auto; font-size:12px; cursor:default; } #table01 { font-size:12px; background-Color:black; color:white; text-align:center; } #playListTitle { background-Color:#001122; color:white; font-size:12px; font-weight:bold; width:100%; height:16px; padding:2px; } #playList { width:150px; height:225px; margin:0px; font-size:12px; background-Color:black; color:white; } #musicList { width:200px; border:buttonface 4px groove; height:80px; position:absolute; right:5px; top:5px; } #musicListTitle { font-size:13px; width:100%; height:20px; background-Color:#C5FFC5; padding:3px; font-weight:bold; } #musicList a { text-decoration:none; width:100%; height:20px; line-height:20px; font-szie:20px; line-height:20px; padding-top:5px; padding-left:10px; } #musicList a:hover { background-Color:#E5FFE5; } 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
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]