if (_nPageCount == null || _nPageCount <= 1) {
return false;
}
if (_nCurrIndex > 0){
if (_nCurrIndex == 1){
var prePage = _sPageName + "." + _sPageExt;
} else {
var prePage = _sPageName + "_" + (_nCurrIndex - 1) + "." + _sPageExt;
}
page+='
上一页';
}
if (_nCurrIndex > 2) {
page+='
1';
}
if (_nCurrIndex > 3) {
page+='
...';
}
for(var i = 0; i < _nPageCount; i++){
var sPageName;
if ((_nCurrIndex - 2) >= 0) {
if (i == (_nCurrIndex - 2)){
if (i == 0) {
sPageName = _sPageName + "." + _sPageExt;
} else {
sPageName = _sPageName + "_" + (_nCurrIndex - 2) + "." + _sPageExt;
}
page+='
' + ( i + 1 ) +'';
}
}
if ((_nCurrIndex - 1) >= 0) {
if (i == (_nCurrIndex - 1)){
if (i == 0) {
sPageName = _sPageName + "." + _sPageExt;
} else {
sPageName = _sPageName + "_" + (_nCurrIndex - 1) + "." + _sPageExt;
}
page+='
' + ( i + 1 ) +'';
}
}
if(i == _nCurrIndex){
page+='
' + (i + 1) + '';
}
if ((_nCurrIndex + 1) <= (_nPageCount - 1)) {
if (i == (_nCurrIndex + 1)){
sPageName = _sPageName + "_" + (_nCurrIndex + 1) + "." + _sPageExt;
page+='
' + ( i + 1 ) +'';
}
}
if ((_nCurrIndex + 2) <= (_nPageCount - 1)) {
if (i == (_nCurrIndex + 2)){
sPageName = _sPageName + "_" + (_nCurrIndex + 2) + "." + _sPageExt;
page+='
' + ( i + 1 ) +'';
}
}
}
for(var j = _nCurrIndex+3 ;j<( _nPageCount>5?5:_nPageCount); j++){
sPageName = _sPageName + "_" + j + "." + _sPageExt;
page+='
' + (j+1) +'';
}
if (_nCurrIndex < (_nPageCount - 4) && _nPageCount > 6) {
page+='
...';
}
if (_nCurrIndex <_nPageCount-3 && _nPageCount >5) {
page+='
'+_nPageCount+'';
}
if (_nCurrIndex < (_nPageCount - 1)){
var prePage = _sPageName + "_" + (_nCurrIndex + 1) + "." + _sPageExt;
page+='
下一页';
}
$("#page").html(page);
}