日期:2014-05-16 浏览次数:20426 次
<div> <span id="spanFirstt"><a href="javascript:first();">FirstPage</a></span> <span id="spanPret">PrePage</span> <span id="spanNextt"><a href="javascript:next();">NextPage</a></span> <span id="spanLastt"><a href="javascript:last();">LastPage</a></span> Page NO.:<span id="spanPageNumt">1</span> /<span id="spanTotalPaget">1</span> </div> <tbody id="tablelsw"> 这里是列表内容 <tbody> <div> <span id="spanFirst"><a href="javascript:first();">FirstPage</a></span> <span id="spanPre">PrePage</span> <span id="spanNext"><a href="javascript:next();">NextPage</a></span> <span id="spanLast"><a href="javascript:last();">LastPage</a></span> Page NO.:<span id="spanPageNum">1</span> /<span id="spanTotalPage">1</span> </div> <script> var theTable = document.getElementById("tablelsw"); var totalPage = document.getElementById("spanTotalPage"); var pageNum = document.getElementById("spanPageNum"); var spanPre = document.getElementById("spanPre"); var spanNext = document.getElementById("spanNext"); var spanFirst = document.getElementById("spanFirst"); var spanLast = document.getElementById("spanLast"); var totalPaget = document.getElementById("spanTotalPaget"); var pageNumt = document.getElementById("spanPageNumt"); var spanPret = document.getElementById("spanPret"); var spanNextt = document.getElementById("spanNextt"); var spanFirstt = document.getElementById("spanFirstt"); var spanLastt = document.getElementById("spanLastt"); var numberRowsInTable = theTable.rows.length; var pageSize = 5; var page = 1; function next(){ hideTable(); currentRow = pageSize * page; maxRow = currentRow + pageSize; if ( maxRow > numberRowsInTable ) maxRow = numberRowsInTable; for ( var i = currentRow; i<maxRow; i++ ){ theTable.rows[i].style.display = ''; } page++; pageNum.innerHTML = page; pageNumt.innerHTML = page; if ( maxRow == numberRowsInTable ) { nextText(); lastText(); } else{ nextLink(); } //showPage(); preLink(); firstLink(); } function pre(){ hideTable(); page--; pageNum.innerHTML = page; pageNumt.innerHTML = page; currentRow = pageSize * page; maxRow = currentRow - pageSize; if ( currentRow > numberRowsInTable ) currentRow = numberRowsInTable; for ( var i = maxRow; i<currentRow; i++ ){ theTable.rows[i].style.display = ''; } if ( maxRow == 0 ){ preText(); firstText(); } nextLink(); lastLink(); } function first(){ hideTable(); page = 1; pageNum.innerHTML = page; pageNumt.innerHTML = page; for ( var i = 0; i<pageSize; i++ ){ theTable.rows[i].style.display = ''; } showPage(); preText(); nextLink(); lastLink(); } function last(){ hideTable(); page = pageCount(); pageNum.innerHTML = page; pageNumt.innerHTML = page; currentRow = pageSize * (page - 1); for ( var i = currentRow; i<