Use js to implement page pagination:
< table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#D2EBF3;" height="32">
Previous page Next page Home page Last page
|
getPage() is a js function, as follows:
//Parameter description: lblPostsCount: The total number of records, by getActivityCount obtained; iPageIndex: global variable, current page number
function getPage(page)
{
if(page==0)//Return to homepage
{
iPageIndex=1;
document.form1.PageCtl1_select.options[iPageIndex-1].selected="true"; //The drop-down box displays the page, the array starts from 0
getActivityList(1);
}
else if(page==11)//Return to the last page
{
iPageIndex=Math.round (lblPostsCount/6);
document.form1.PageCtl1_select.options[iPageIndex-1]. selected="true";
getActivityList(iPageIndex);
}
else //Previous page, next page
{
iPageIndex=iPageIndex page;
if(iPageIndex< =0) //If it is the first page, click on the previous page or stay on the first page
iPageIndex=1;
else if(iPageIndex>Math.round (lblPostsCount/6))//If it is Click the next page on the last page to stay on the last page
iPageIndex=Math.round (lblPostsCount/6);
else
{
document.form1.PageCtl1_select.options[iPageIndex-1 ].selected="true";
getActivityList(iPageIndex);//Call List
}
}
}
function getActivityCount() //Get the number of records
{
var variable=['strWhere'];
var value=new Array(1);
value[0]="iStatus=2 and iPublic=5";
newRequest( "getActivityCount",variable,value,getAllActivityCountShow);
beginRequest();
}
function getAllActivityCountShow()
{
var xmlhttp=xmlHttpRequest;
var str=xmlhttp.responseText ; Display the value and text of the drop-down box;
for(i=1;i<=Math.round (lblPostsCount/6);i )
{
var option=document.createElement("option" );
option.value=i;
option.text=i;
document.form1.PageCtl1_select.options.add(option);
}
}
Click the drop-down box to display the function on which page:
{
getActivityList(pageNo);
}