幽灵资源网 Design By www.bzswh.com
本文实例讲述了纯JavaScript实现的分页插件。分享给大家供大家参考。具体如下:
//总条数(必填) var Num=Number(<"至少需要显示一个页码!"); } var prev = index - 1;//上一页 var next = index+ 1;//下一页 var str = "<tr>"; if(count==0){ str += "<td>共<a href='#'>0</a>页</td><td>"; }else if(index>count||index<=0){ str="<td style='color:blue;' >页码超出范围</td>"; }else if (count > 0) { str += "<td>"; if(first>1){ str += " <span style='color:#4169E1;' >...</span> "; } var i=1; for(i=first;i<=last; i++){ if(i==index){ str += " <a href='#' style='color:#4169E1;' onclick='submit(" + i + ");'>[" + i+ "]</a> "; }else{ str += " <a href='#' onclick='submit(" + i + ");'>" + i+ "</a> "; } } if(last<count){ str += " <span style='font-size:16px;color:#4169E1;' >...</span> "; } str+="</td><td style='font-size: 14px;'>共<a href='#first' style='color:#4169E1;font-size: 16px;' >"+ Num +"</a>条</td>"; /* if(index!=1){ str +="<td style='width:60px;font-family: 微软雅黑;font-size: 14px;' ><a href='#' id='prev' onclick='submit(" + prev+ ");'>上一页</a></td>"; } if(index<count){ str +="<td style='width:60px;font-family: 微软雅黑;font-size: 14px;'><a href='#' id='next' onclick='submit("+ next + ");'>下一页</a></td>"; }*/ if(index!=1&&count>1){ str += "<td style='width:40px;font-family: 微软雅黑;font-size: 14px;white-space: nowrap;'> <a href='#' id='first' name='first' onclick='submit(1);'>首页</a> </td>"; } if(index!=count&&count>1&&index<count){ str += "<td style='width:40px;font-family: 微软雅黑;font-size: 14px;white-space: nowrap;'> <a href='#' onclick='submit(" + count+ ");'>尾页</a> </td>" ; } str+="</tr>"; } //分页区域填写 $('.page').html(str); <table class="page"> <tr><td>此处分页只需要传递给我当前页码和总页数即可</td></tr> </table> //根据页码查询, function submit(pageIndex) { //var sortInfo = $.getUrlParam('sortInfo');//判断是哪一个页面的查询 var url = "<"+pageIndex+"&field=<"; window.location.href=url; }
希望本文所述对大家的javascript程序设计有所帮助。
标签:
JavaScript,分页,插件
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。