function Paging(pageNum,pageSize,totalCount,skipCount,fuctionName,currentStyleName,currentUseLink,preText,nextText,firstText,lastText)
{
//debugger;
var returnValue = "";
var begin = 1;
var end = 1;
var totalpage = Math.floor(totalCount / pageSize);
if(totalCount % pageSize >0)
{
totalpage ++;
}
if(preText == null)
{
firstText = "prev";
}
if(nextText == null)
{
nextText = "next";
}
begin = pageNum - skipCount;
end = pageNum + skipCount;
if(begin <= 0)
{
end = end - begin +1;
begin = 1;
}
if(end > totalpage)
{
end = totalpage;
}
for(count = begin;count <= end;count ++)
{
if(currentUseLink)
{
if(count == pageNum)
{
returnValue += "<a class=/""+currentStyleName+"/" href=/"javascript:void(0);/" οnclick=/""+fuctionName+"("+count.toString()+");/">"+count.toString()+"</a> ";
}
else{
returnValue += "<a href=/"javascript:void(0);/" οnclick=/"" + fuctionName + "(" + count.toString() + ");/">" + count.toString() + "</a> ";
}
}
else {
if (count == pageNum) {
returnValue += "<span class=/""+currentStyleName+"/">"+count.toString()+"</span> ";
}
else{
returnValue += "<a href=/"javascript:void(0);/" οnclick=/""+fuctionName+"("+count.toString()+");/">"+count.toString()+"</a> ";}
}
}
if(pageNum - skipCount >1)
{
returnValue = " ... "+returnValue;
}
if(pageNum + skipCount < totalpage)
{
returnValue = returnValue + " ... ";
}
if(pageNum > 1)
{
returnValue = "<a href=/"javascript:void(0);/" οnclick=/""+fuctionName+"("+(pageNum - 1).toString()+");/"> " + preText + "</a> " + returnValue;
}
if(pageNum < totalpage)
{
returnValue = returnValue + " <a href=/"javascript:void(0);/" οnclick=/""+fuctionName+"("+(pageNum+1).toString()+");/">" + nextText + "</a>";
}
if(firstText!= null)
{
if(pageNum >1)
{
returnValue = "<a href=/"javascript:void(0);/" οnclick=/""+fuctionName+"(1);/">" + firstText + "</a> " + returnValue;}
}
if(lastText !=null)
{
if(pageNum < totalpage)
{
returnValue = returnValue + " " + " <a href=/"javascript:void(0);/" οnclick=/""+fuctionName+"("+totalpage.toString()+");/">" + lastText + "</a>";}
}
return returnValue;
}
javascript 实现分页条
最新推荐文章于 2022-01-13 16:44:56 发布