终于写好了播放器清单分页
写了N久,终于搞定了,好高兴哦!
拿来分享!!!!
演示:http://bbs.lulu.e-168.cn
方法超级简单:
在player.js里
查找
- function getPlaylist(target,obj) {
- if(typeof(wmp) != "undefined") {
- var res = "";
- var count = wmp.currentPlaylist.count;
- res += "<table width=100% style=table-layout:fixed; cellpadding=0 cellspacing=0>\n";
- for(i=0;i<=count-1;i++) {
- var itemname = wmp.currentPlaylist.item(i).name;
- var n = i+1;
- res += " <tr><td align=right id=no>"+n+"</td><td nowrap id=name title=""+itemname+""><span style=cursor:hand; onclick=playItem("+n+");>"+itemname+"</span></td><td align=right id=button><img src=images/btn_listen.gif style=cursor:hand; align=absmiddle onclick=playItem("+n+");><img src=images/btn_delete.gif style=cursor:hand; align=absmiddle onclick=deleteItem("+n+");getPlaylist();></td></tr>\n";
- }
- res += "</table>\n";
- if(!target) {
- playlist.innerHTML = res;
- } else {
- target.innerHTML = res;
- }
- }
- }
复制代码
替换为:
- var page=1;
- function getpage(no)
- {
- page=no;
- getPlaylist();
- }
- function getPlaylist(target,obj) {
- if(typeof(wmp) != "undefined") {
- var res = "";
-
- var startpage,pagemax=15,allpage,start,end,j; //pagemax=15,每页的歌曲数目
-
- var count = wmp.currentPlaylist.count;
-
- startpage=page;
-
- if(pagemax>count)
- pagemax=count;
-
- allpage=Math.ceil(count/pagemax);
-
- start=(startpage-1)*pagemax;
- end=startpage*pagemax;
-
- if(page==allpage)
- end=count;
-
- res += "<table width=100% style=table-layout:fixed; cellpadding=0 cellspacing=0>\n";
- for(i=start;i<=end-1;i++) {
- var itemname = wmp.currentPlaylist.item(i).name;
- var n = i+1;
- res += " <tr><td align=right id=no>"+n+"</td><td nowrap id=name title=""+itemname+""><span style=cursor:hand; onclick=playItem("+n+");>"+itemname+"</span></td><td align=right id=button><img src=images/btn_listen.gif style=cursor:hand; align=absmiddle onclick=playItem("+n+");><img src=images/btn_delete.gif style=cursor:hand; align=absmiddle onclick=deleteItem("+n+");getPlaylist();></td></tr>\n";
- }
-
- res += "</table>\n";
-
- res += "<table width=100% cellpadding=0 cellspacing=0 > ";
- res +="<tr><td nowrap > All have: <font color=#FF0000> "+allpage+"</font> Page";
- res +=" <font color=#FF0000> "+page+"</font>/"+allpage+"</td></tr>";
- res +="<tr><td > <font color=red >Jump page-></font>";
-
- for( j=1; j<=allpage; j++)
- {
- if(!(j%15)) //够15页换行
- res +="<br>";
- res +=" <a href="javascript:getpage(" + j + ")">[" + j + "]<a> ";
- }
- res +="</td></tr>";
- res += "</table>";
- if(!target) {
- playlist.innerHTML = res;
- } else {
- target.innerHTML = res+str;
- }
- }
- }
复制代码
ok
其中
为每页的歌曲数目,你可以根据实际情况修改!
为够15页换行,你可以根据实际情况修改!
ok!
你的支持,是我最大的动力!
另外加两个相关的:
还有:
原帖由 拒买日本货 于 2005-7-12 09:19 发表
出错了!
原播放器里有给选择打勾的小框框,,,现在没了?!
也就是说,此功能没有了,,,
请更改...这样才完美..........
请看15楼
https://discuz.dismall.com/viewth ... p;extra=#pid1052569
[ 本帖最后由 lu5266 于 2005-8-2 13:26 编辑 ] |