From: IECN.Net ; Author: Zhongzhong
/**
* Paging class structure
* Parameter nTotalList: Total number of items
* Parameter nPageSize: Number of items displayed on each page
* Parameter nPageNum: Current page number
* Parameter sPageUrl: The URL of the paging link, the page number is replaced by [pn], which will be replaced by the actual page number when output
* Parameter nPageListSize: The page number list (drop-down box) displayed Maximum number of page numbers.该参数可省略,默认100
*/
function Pagination(nTotalList, nPageSize, nPageNum, sPageUrl, nPageListSize) {
this.totalList = nTotalList;
this.pageSize = nPageSize;
this.pageNum = nPageNum;
if (nTotalList == 0)
this.totalPages = 1;
else
this.totalPages = Math.floor((this.totalList-1)/this.pageSize 1);
this.pageUrl = sPageUrl;
if (arguments[4])
this.pageListSize = nPageListSize;
else
this.pageListSize = 100;
}
/**
* Generate pagination and output HTML directly
* No parameters
* No return value
*/
Pagination.prototype.generate = function() {
var output = "";
output = "
"; output = "共 " this.totalList " 条 每页 " this.pageSize " 条 当前第 "; output = ""; output = "/" this.totalPages " 页 "; if (this.pageNum == 1) { output = "[首页] "; output = "[上页] "; } else { output = "[首页] "; output = "[上页] "; } if (this.pageNum == this.totalPages) { output = "[下页] "; output = "[尾页]"; } else { output = "[下页] "; output = "[尾页] "; } output = " |