
var nPageIndex,nPageSize,nRows,nPages;

nPageSize =  20 ;   //定义每页的条数量；
nPageIndex = 0 ;   //当前页的下标；
nRows = document.all("tbList").rows.length;		//表格总共的行数；
nPages = parseInt( nRows / nPageSize ) ;		//分页数目；
if ( nRows % nPageSize != 0 ) nPages++ ;

NextPage( )

function NextPage()//下一页
{

	nPageIndex++;
	if ( nPageIndex >= nPages ) nPageIndex = nPages ;
	
	for ( var i=0 ;  i < nRows ; i++ )	{
		if ( i >= (nPageIndex-1) * nPageSize && i < nPageIndex *  nPageSize  ){	
			document.all("tbList").rows.item(i).style.display = "block";
			}
		else{
			document.all("tbList").rows.item(i).style.display = "none";
			}
	}
	

}

function FrontPage()//上一页
{
	nPageIndex--;
	if ( nPageIndex <= 0 ) NextPage() ;

	for ( var i=0 ;  i < nRows ; i++ )	{
		if ( i >= ( nPageIndex - 1) * nPageSize && i < nPageIndex *  nPageSize  ){	
			document.all("tbList").rows.item(i).style.display = "block";
			}
		else{
			document.all("tbList").rows.item(i).style.display = "none";
			}
	}
}

function FirstPage()//首页
{
	nPageIndex = 1;
	for ( var i=0 ;  i < nRows ; i++ )	{
		if ( i >= ( nPageIndex - 1) * nPageSize && i < nPageIndex *  nPageSize  ){	
			document.all("tbList").rows.item(i).style.display = "block";
			}
		else{
			document.all("tbList").rows.item(i).style.display = "none";
			}
	}
}

function LastPage()//尾页
{
	nPageIndex = nPages;
	for ( var i=0 ;  i < nRows ; i++ )	{
		if ( i >= ( nPageIndex - 1) * nPageSize && i < nPageIndex *  nPageSize  ){	
			document.all("tbList").rows.item(i).style.display = "block";
			}
		else{
			document.all("tbList").rows.item(i).style.display = "none";
			}
	}
}

function ShowFirstPage()//显示首页
{
document.write("<FONT class='cn' style='CURSOR: hand' onclick=FirstPage();>首页</FONT>");
}

function ShowFrontPage()//显示上一页
{
document.write("<FONT class='cn' style='CURSOR: hand' onclick=FrontPage();>上一页</FONT>");
}

function ShowNextPage()//显示下一页
{
document.write("<FONT class='cn' style='CURSOR: hand' onclick=NextPage();>下一页</FONT>");
}

function ShowLastPage()//显示尾页
{
document.write("<FONT class='cn' style='CURSOR: hand' onclick=LastPage();>尾页</FONT>");
}

function ShowPageBar()//显示分页工具条
{
document.write("<FONT class='cn' style='CURSOR: hand' onclick=FirstPage();>首页</FONT>&nbsp;<FONT class='cn' style='CURSOR: hand' onclick=FrontPage();>上一页</FONT>&nbsp;<FONT class='cn' style='CURSOR: hand' onclick=NextPage();>下一页</FONT>&nbsp;<FONT class='cn' style='CURSOR: hand' onclick=LastPage();>尾页</FONT>");
}
