<html> <head> <title>My HTML Player</title> <style> body { overflow:auto; font-size:12px; cursor:default; } #table01 { font-size:12px; background-Color:black; color:white; text-align:left; } #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; } </style> <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<playList.options.length-1){ playList.options[playList.options.selectedIndex+1].selected=true; }else{ playList.options[0].selected=true; } MediaPlayer1.fileName=playList.value; MediaPlayer1.play(); setTimeout('MediaPlayer1.play();MediaPlayer1.attachEvent("PlayStateChange",checkPlayStatus);',1000); } }catch(e){} } </script> <body onload="init();"> <table id=table01> <tr> <td> <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="MediaPlayer1" width="286" height="225" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> <param name="AudioStream" value="-1"> <param name="AutoSize" value="-1"> <!--是否自动调整播放大小--> <param name="AutoSta</body></html>