📄 pagination.js
字号:
if (this.length<=currCount){
htmltxt += "【<a href='javascript:myPage.nextPage();' >下页</a>】";
}
else
{
htmltxt += "【下页】";
}
}
htmltxt += "第<input type='text' name='pageno' size=2 value='"+this.current+"'>页";
htmltxt += "<input type='button' onclick=myPage.goPage('pageno') value='go' name='gopage'>";
if (!this.noCount){
htmltxt += "/共"+this.total+"页";
htmltxt += "共"+myPage.count + "条";
}
document.write( htmltxt);
}
//5.1翻页风格
function printPageCode51(pageControlStyle,currRowCount,groupNum,txClass,btClass)
{
switch(pageControlStyle)
{
case "link": this.printPageCode1(currRowCount,txClass); break;
case "button": this.printPageCode2(currRowCount,txClass,btClass); break;
case "group": this.printPageCode3(currRowCount,groupNum,txClass); break;
default : break;
}
}
/*
* 链接式翻页
*/
function printPageCode1(currRowCount,txClass)
{
var htmltxt="";
var currCount=currRowCount;
if(currCount==NaN || currCount==undefined || currCount == null){
return;
}
if (!this.noCount){
htmltxt = htmltxt+this.current+"/"+this.total;
}
// 如果当前页数大于1,则显示"首页"、"上页"的链接;否则显示普通文字提示
if(this.current>1){
htmltxt += "<a href='javascript:myPage.firstPage();' > 首页</a>";
htmltxt += "<a href='javascript:myPage.previousPage();' > 上页</a>";
}
else
{
htmltxt += " 首页";
htmltxt += " 上页";
}
//如果PageCond/count的值不为"noCount",则要统计总记录条数,可显示“尾页”;否则没有“尾页”选项
if (!this.noCount){
//如果当前页小于总页数,则显示“下页”,“尾页”链接,否则显示普通文字提示
if (this.current<this.total ) {
htmltxt += "<a href='javascript:myPage.nextPage();' > 下页</a>";
htmltxt += "<a href='javascript:myPage.lastPage();' > 尾页</a>";
}
else
{
htmltxt += " 下页";
htmltxt += " 尾页";
}
}else{
//如果当前页小于总页数,则显示“下页”链接,否则显示普通文字提示
if (this.length<=currCount){
htmltxt += "<a href='javascript:myPage.nextPage();' > 下页</a>";
}
else
{
htmltxt += " 下页";
}
}
htmltxt += " 转到第<input type='text' name='pageno' size=2 value='"+ this.current +"' class='"+ txClass +"'>页 ";
document.write( htmltxt);
}
function printPageCode2(currRowCount,txClass,btClass)
{
var htmltxt="";
var currCount=currRowCount;
if(currCount==NaN || currCount==undefined || currCount == null){
return;
}
if (!this.noCount){
htmltxt += "第"+this.current+"页,共"+this.total+"页";
}
// 如果当前页数大于1,则显示"首页"、"上页"的按钮;否则显示不可用按钮
if(this.current>1){
htmltxt += " <input type='button' onclick='javascript:myPage.firstPage();' value='首页' class='"+ btClass +"'/>";
htmltxt += " <input type='button' onclick='javascript:myPage.previousPage();' value='上页' class='"+ btClass +"'/>";
}
else
{
htmltxt += " <input type='button' value='首页' disabled class='"+ btClass +"'/>";
htmltxt += " <input type='button' value='上页' disabled class='"+ btClass +"'/>";
}
//如果PageCond/count的值不为"noCount",则要统计总记录条数,可显示“尾页”;否则没有“尾页”选项
if (!this.noCount){
//如果当前页小于总页数,则显示“下页”,“尾页”的按钮;否则显示不可用按钮
if (this.current<this.total ) {
htmltxt += " <input type='button' value='下页' onclick='javascript:myPage.nextPage();' class='"+ btClass +"'/>";
htmltxt += " <input type='button' value='尾页' onclick='javascript:myPage.lastPage();' class='"+ btClass +"'/>";
}
else
{
htmltxt += " <input type='button' value='下页' disabled class='"+ btClass +"'/>";
htmltxt += " <input type='button' value='尾页' disabled class='"+ btClass +"'/>";
}
}else{
//如果当前页小于总页数,则显示“下页”的按钮;否则显示不可用按钮
if (this.length<=currCount){
htmltxt += " <input type='button' value='下页' onclick='javascript:myPage.nextPage();' class='"+ btClass +"'/>";
}
else
{
htmltxt += " <input type='button' value='下页' disabled class='"+ btClass +"'/>";
}
}
htmltxt += " 转到第<input type='text' name='pageno' size=2 value='"+ this.current +"' class='"+ txClass +"'>页";
document.write( htmltxt);
}
//使用此风格时,PageCond/count的值不能为"noCount"
function printPageCode3(currRowCount,showPageCount,txClass)
{
var htmltxt="";
var currCount=currRowCount;
var i=0; //起始页号
var totalGroup=0; //分组总数
var currGroup=0; //当前组号
if (!this.noCount){
if(this.total%showPageCount==0)
{
totalGroup=Math.floor(this.total/showPageCount);
}
else
{
totalGroup=Math.floor(this.total/showPageCount)+1;
}
}
if(this.current%showPageCount==0)
{
currGroup=Math.floor(this.current/showPageCount);
}
else
{
currGroup=Math.floor(this.current/showPageCount)+1;
}
i=showPageCount*(currGroup-1)+1;
if(currCount==NaN || currCount==undefined || currCount == null){
return;
}
if (!this.noCount){
htmltxt += "共"+this.total+"页"; //"第"+this.current+"页"
}
//判断"<<"
if(currGroup==1)
{
htmltxt += " <<";
}
else
{
htmltxt += " <a href='javascript:myPage.go("+ (1 + showPageCount*(currGroup-2)) +");'> <<</a>";
}
//alert(this.total);
//列出选择页号
while(i<=showPageCount*currGroup)
{
if (!this.noCount){
if(i>this.total) break;
}
if(i!=this.current)
{
htmltxt += " <a href='javascript:myPage.go("+i+");'>"+i+"</a>";
}
else
{
htmltxt += " <font color='red'>"+i+"</font>";
}
i++;
}
//判断">>"
if (!this.noCount){
if(currGroup==totalGroup)
{
htmltxt += " >>";
}
else
{
htmltxt += " <a href='javascript:myPage.go("+(showPageCount*currGroup+1)+");'> >></a>";
}
}
else
{
if (this.length<=currCount){
htmltxt += " <a href='javascript:myPage.go("+(showPageCount*currGroup+1)+");'> >></a>";
}
else
{
htmltxt += " >>";
}
}
htmltxt += " 转到第<input type='text' name='pageno' size=2 value='"+ this.current +"' class='"+ txClass +"'>页";
document.write( htmltxt);
}
}
//判断是否为数字,是则返回true,否则返回false
function isNumber( s ){
var regu = "^[0-9]+$";
var re = new RegExp(regu);
if (s.search(re) != -1) {
return true;
} else {
return false;
}
}
//调式时用来输出结果
function print(s)
{
document.write(s);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -