function dolistpage(pagerow,pagenum,rowcount,pagecount){ $("#pagemsg").html("每页显示"+pagerow+"条,当前" + pagenum + "https://www.jb51.net/" +pagecount + "页 共" +rowcount + "条"); if (pagenum == 1) { $("#fpbtn").attr("disabled", true); $("#rpbtn").attr("disabled", true); }else { $("#fpbtn").removeAttr("disabled"); $("#rpbtn").removeAttr("disabled"); } if (pagenum == pagecount) { $("#npbtn").attr("disabled", true); $("#lpbtn").attr("disabled", true); }else { $("#npbtn").removeAttr("disabled"); $("#lpbtn").removeAttr("disabled"); } $("#fpbtn").click(function(){ loadtpage(1); }); $("#rpbtn").click(function(){ loadtpage(pagenum - 1); }); $("#npbtn").click(function(){ if ((pagenum + 1) >= pagecount) loadtpage(pagecount); else loadtpage(pagenum + 1); }); $("#lpbtn").click(function(){ loadtpage(pagecount); }); $("#gpbtn").click(function(){ var tzys = $("#gpinput").val(); var re = /^[1-9]+[0-9]*$/; if (tzys == null || tzys == undefined || tzys == '') { alert("请输入跳转页数!"); $("#gpinput").focus(); return; } if (!re.test(tzys)) { alert("请输入正确跳转页数!"); $("#gpinput").focus(); return; } if (tzys > pagecount) tzys = pagecount; if (tzys <= 0) tzys = 1; loadtpage(tzys); }); $("#gpinput").val(pagenum); }
HTML代码:
<table> <tfoot> <tr> <td colspan="11"> <span></span> <span> <span>当前0/0页</span> <input type="button" value="首页"/> <input type="button" value="上页"/> <input type="button" value="下页"/> <input type="button" value="尾页"/> <span>跳转 <input type="text" size="3" value="0"/>页 </span> <input type="button" value="跳转"/> </span> </td> </tr> </tfoot> </table>