曲阿论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2262|回复: 2

专辑播放器03代码实例

[复制链接]
发表于 2011-12-12 20:43:09 | 显示全部楼层 |阅读模式 来自 中国江苏镇江
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  4. <title>网页播放器</title>
  5. </head>
  6. <body>
  7. <style>
  8. body {font-size:9pt; font-family:dadum10; scrollbar-highlight-color:green: scrollbar-shadow-color: green; scrollbar-arrow-color: green; scrollbar-face-color:#DAEBDA;scrollbar-3dlight-color: #DAEBDA; scrollbar-darkshadow-color:#DAEBDA; scrollbar-track-color:gainsboro; }
  9. td{font-size:9pt; color:#000000; font-family:dadum10; line-height:180%;}
  10. div {font-size:9pt;}
  11. input{height:16}
  12. .syes{font-size:9pt;width:77; color:#ffffff; background-color:#3a60a0;height:17;cursor:hand;border-width:1;border-color:#cccccc;}
  13. </style>
  14. <SCRIPT Language="Javascript">
  15. var url_str="你会不会(梁静茹)=http://storage.live.com/items/5f89c53709c71943%21363?3Ffilename%3D/01.mp3|苦情歌(周传雄)=http://storage.live.com/items/5f89c53709c71943%21364?3Ffilename%3D/02.mp3|我爱你胜过你爱我(冷漠 杨小曼)=http://storage.live.com/items/5f89c53709c71943%21365?3Ffilename%3D/03.mp3|最后一次相依偎(姜玉阳)=http://storage.live.com/items/5f89c53709c71943%21366?3Ffilename%3D/04.mp3|这就是爱(张杰)=http://storage.live.com/items/5f89c53709c71943%21367?3Ffilename%3D/05.mp3|对话(冷漠 云菲菲)=http://storage.live.com/items/5f89c53709c71943%21168?3Ffilename%3D/06.mp3|老男孩(筷子兄弟)=http://storage.live.com/items/5f89c53709c71943%21369?3Ffilename%3D/07.mp3|飞不过沧海的蝶(庄妮)=http://storage.live.com/items/5f89c53709c71943%21370?3Ffilename%3D/08.mp3|我的爱情不见了(龙梅子 蓝雨)=http://storage.live.com/items/5f89c53709c71943%21371?3Ffilename%3D/09.mp3|舍不得也要说再见(六哲)=http://storage.live.com/items/5f89c53709c71943%21372?3Ffilename%3D/10.mp3|哭过才知道爱过(金泽)=http://storage.live.com/items/5f89c53709c71943%21373?3Ffilename%3D/11.mp3|小三(冷漠)=http://storage.live.com/items/5f89c53709c71943%21374?3Ffilename%3D/12.mp3|春天里(汪峰)=http://storage.live.com/items/5f89c53709c71943%21375?3Ffilename%3D/13.mp3|偷偷的哭(陈玉建)=http://storage.live.com/items/5f89c53709c71943%21376?3Ffilename%3D/14.mp3|星月神话(金莎)=http://storage.live.com/items/5f89c53709c71943%21377?3Ffilename%3D/15.mp3|最幸福的人(曾春年)=http://storage.live.com/items/5f89c53709c71943%21178?3Ffilename%3D/16.mp3|荷塘月色(凤凰传奇)=http://storage.live.com/items/5f89c53709c71943%21379?3Ffilename%3D/17.mp3"
  16. var je="=";
  17. var url="|"; var subject_arr = new Array();var url_arr = new Array();var sel_arr = new Array();
  18. var inx=0, old_inx=0;var now_song=0;var max_count=0;var tm=null;var tm_cnt=0;var err_stat=false;
  19. function p_play(){tm_cnt++;if((SyesPlayer.filename==url_arr[inx])&&(!err_stat)) {
  20. SyesPlayer.play();clearTimeout(tm);tm=null;tm_cnt=0;}
  21. if(tm_cnt==5){clearTimeout(tm);tm=null;tm_cnt=0;}}
  22. function one_play(i){if(tm != null) clearTimeout(tm);old_inx=inx;
  23. inx=i;SyesPlayer.filename=url_arr[i];tm_cnt=0;err_stat=false;tm=setTimeout("p_play()",1000);
  24. stat.innerHTML="<marquee bgcolor=black scrollamount=2 width=220><font color=cornflowerblue>"+subject_arr[i]+"--更多音乐分享请访问韭菜的博客 www.yy708090.com "+"</font></marquee>";
  25. eval('m'+old_inx).style.color='';eval('m'+inx).style.color='D9E7FF';}
  26. function onlistover(src){src.style.color="FF3000"}function onlistout(src){src.style.color=""}
  27. function syes_next(){if(now_song<(max_count-1)) now_song++;else now_song=0;one_play(sel_arr[now_song]);}
  28. function listen_check(){
  29. var songlist = ""
  30. var chk = false
  31. var i, url;
  32. for(i=0; i<document.list_form.elements.length; i++) {
  33. var e=document.list_form.elements[i];
  34. if(e.name == 'chk') {
  35. if(e.checked == true) {
  36. chk = true;
  37. songlist = songlist + e.value + ",";}}}
  38. if(chk == true ){
  39. sel_arr=songlist.split(',');
  40. now_song=0;
  41. max_count=sel_arr.length-1;
  42. one_play(sel_arr[now_song]);
  43. }else{
  44. max_count=0;
  45. alert("www.5941t.com");}}
  46. function all_check(){
  47. var i;
  48. for(i=0; i<document.list_form.elements.length; i++) {
  49. var e=document.list_form.elements[i];
  50. if(e.name == 'chk') {
  51. if(e.checked != true)e.checked = true;}}}
  52. function one_check(k){
  53. var i;
  54. for(i=0; i<document.list_form.elements.length; i++) {
  55. var e=document.list_form.elements[i];
  56. if((e.name == 'chk')&&(e.value == k)) {
  57. e.checked = true;break;}}}
  58. function un_check(){var i;
  59. for(i=0; i<document.list_form.elements.length; i++) {
  60. var e=document.list_form.elements[i];
  61. if(e.name == 'chk') {
  62. if(e.checked == true) e.checked = false}}}
  63. function set_list(){
  64. var i, cnt, str;
  65. cnt=url_str.split(url).length;
  66. str="<form name=list_form><table>";
  67. for(i=0;i<cnt;i++){
  68. subject_arr[i]=(i+1)+'. '+url_str.split(url)[i].split(je)[0];
  69. url_arr[i]=url_str.split(url)[i].split(je)[1];
  70. str+=" <tr id=m"+i+">"+"<td><input type=checkbox onfocus='this.blur()' name='chk' value="+i+"></td><td><span style=cursor:hand onmouseover='onlistover(this)' onmouseout='onlistout(this)' onclick='one_play("+i+")'>";
  71. str+=subject_arr[i]+'</span>';}+"</td></tr></table></form>";document.all["list_tbl"].innerHTML=str;}
  72. var trackPositionSts;var positionSet = false;
  73. var varlength=500;var varstartpoint=54;
  74. function SyesPlayerSetPosition() {
  75. if(positionSet == true) {antiauto=30;
  76. positionSet=false;dragapproved = false;
  77. per = (document.all["position"].style.pixelLeft - varstartpoint)/varlength;
  78. psit = Math.floor(document.all.SyesPlayer.Duration * per);
  79. setPosition(psit)}}
  80. function TrackPosition() {
  81. positionSet = true;iex = event.clientX;iey = event.clientY;
  82. tempx = document.all.position.style.pixelLeft;
  83. tempy = document.all.position.style.pixelTop;
  84. dragapproved=true;
  85. document.onmousemove=positionDragControl;
  86. if(document.all) document.onmouseup = SyesPlayerSetPosition}
  87. function positionDragControl(){
  88. if(dragapproved == true){
  89. var mov = tempx + event.clientX - iex;
  90. if(mov >= varstartpoint && mov <= varstartpoint+varlength)
  91. {document.all["position"].style.pixelLeft = tempx + event.clientX - iex}return false}}
  92. function setPosition(psit){document.all.SyesPlayer.CurrentPosition = psit}
  93. function setTrackIcon() {
  94. if(positionSet == false){
  95. var nowposition = Math.floor(document.all["SyesPlayer"].CurrentPosition);
  96. var totalposition = Math.floor(document.all.SyesPlayer.Duration);
  97. if (nowposition > 0){
  98. document.all["position"].style.pixelLeft = varstartpoint + (varlength * (nowposition / totalposition));}}}
  99. function muinit(){trackPositionSts = setInterval('setTrackIcon()',400)}
  100. </SCRIPT>
  101. </head>
  102. <center>
  103. <body onLoad="muinit();" leftmargin=0 topmargin=10 oncontextmenu="return false" ondragstart="return false" onselectstart="return false" bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
  104. <TABLE style="filter=progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#ffffff, EndColorStr=#3a60a0)"cellpadding="0" cellspacing="0" border="1" bordercolor="#3a60a0" width=500>
  105. <TR>
  106. <TD>
  107. <table background="http://bbs.danyangnet.com/data/attachment/forum/201112/12/185045fo3kqddl3lwflflz.jpg" style="filter: alpha(opacity=100,style=3,finishopacity=0)" width=500 height=500" align=right>
  108. <tr>
  109. <td>
  110. <EMBED src="http://imgfree.21cn.com/free/flash/7.swf"width=500 height=500 type=application/x-shockwave-flash wmode="transparent"></embed>
  111. </td>
  112. </tr>
  113. </table>
  114. <TABLE cellpadding="0" cellspacing="0" border="0">
  115. <TR><TD align="left">
  116. <div style=margin-left:50;margin-top:30;margin-bottom:20;><input type=button onclick='all_check()' onfocus='this.blur()' value='全选'class=syes> <input type=button onclick='un_check()' onfocus='this.blur()' value='反选'class=syes> <input type=button onclick='listen_check()' onfocus='this.blur()' value='播放'class=syes> </div>
  117. </td>
  118. </tr>
  119. <TR>
  120. <TD height=10><div style=margin-left:60;><font color=black face="verdana" size=3><b>2011流行本色DTS-ES系列 CD1</b></font></div><br> </td></tr>
  121. <TR>
  122. <TD>
  123. <div id=list_tbl style="margin-top:2;margin-left:50; width:500; height:320; overflow:auto;"></div>
  124. </td>
  125. </tr>
  126. <TR>
  127. <TD height=10>
  128. </td>
  129. </tr>
  130. <TR>
  131. <TD align="center">
  132. <div style="position:relative;">
  133. <DIV id=stat style="position:absolute;left:-135px; top:6px">
  134. </div>
  135. </div>
  136. <object id="SyesPlayer" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" width="350" height="22" style="margin-top:6px;">
  137. <param name="AutoStart" value="true"><param name="volume" value="0"><PARAM NAME="ShowPositionControls" VALUE="0"><param name="ShowControls" value="1"><param name="ShowPositionControls" value="1"><param name="ShowStatusBar" value="1"></object><br><br>
  138. <input type=button onfocus='this.blur()' onclick='document.SyesPlayer.pause()'value='暂停'class='syes'> <input type=button onfocus='this.blur()' onclick='document.SyesPlayer.stop()' value=' 停止 'class='syes'> <input type=button onfocus='this.blur()' onclick='document.SyesPlayer.play()' value=' 播放 'class='syes'> <input type=button onclick='syes_next()' onfocus='this.blur()' value='前进'class=syes> <br><br><br>
  139. </td></tr></TABLE></td></tr></TABLE>
  140. <span title="" id="position" style="position:absolute;cursor:hand; left:-135px; top:-31px; z-index:2;color:white" onmousedown="TrackPosition()"; onfucus=this.blur()></span>
  141. <script>set_list();all_check();listen_check();</script>
  142. <script event=EndOfStream for=SyesPlayer language=javascript>syes_next();</script>
  143. <script language=javascript for=SyesPlayer Event=Error> var subject=subject_arr[inx];SyesPlayer.stop(); if(max_count==1) {err_stat=true;}else {syes_next()} </script>
  144. </body>
  145. </html>
复制代码

 楼主| 发表于 2011-12-12 20:43:41 | 显示全部楼层 来自 中国江苏镇江
各位请保存在你的电脑里,想用它就不要删除。谢谢。
发表于 2011-12-13 18:15:05 | 显示全部楼层 来自 中国江苏镇江
耘 发表于 2011-12-12 20:43
各位请保存在你的电脑里,想用它就不要删除。谢谢。

{:1_168:}嘿嘿,我都放进空间收藏了,谢谢耘老师!{:1_212:}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|丹阳新闻网(https://www.dy001.cn) ( 苏ICP备05003163号 )

GMT+8, 2024-11-22 10:14 , Processed in 0.062960 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

快速回复 返回顶部 返回列表