Use js to implement page paging:
CopyCode The Code is as follows: <Table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" style = "background-color: # d2ebf3; "Height =" 32 ">
<Tr> <TD align = "right" bgcolor = "# f7f7f7" Height = "36">
<A href = "javascript: void (0)" onclick = "getpage (-1)" style = "visibility: visible" id = "up"> previous page </a>
<A href = "javascript: void (0)" onclick = "getpage (1)" style = "visibility: visible" id = "Next"> next page </a>
<A href = "javascript: void (0)" onclick = "getpage (0)" style = "visibility: visible"> homepage </a>
<A href = "javascript: void (0)" onclick = "getpage (11)"> last page </a>
<Form name = "form1" id = "form2">
<Select name = 'pagectl1 _ select' id = "select" onchange = 'sd _ web_pagectlgootherpage (this. value); 'style = "width: 30px"> </SELECT> // display pages by drop-down
</Form>
</TD> </tr>
</Table>
Getpage () is a JS function, as follows:
Copy code The Code is as follows: // parameter description: lblpostscount: Total number of records, obtained by getactivitycount; ipageindex: global variable, current page number
Function getpage (page)
{
If (page = 0) // return to the home page
{
Ipageindex = 1;
Document. form1.pagectl1 _ select. Options [iPageIndex-1]. Selected = "true"; // the page number displayed in the drop-down box, starting 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 the previous page, or keep it on the first page
Ipageindex = 1;
Else if (ipageindex> math. Round (lblpostscount/6) // if the last page is still clicked on the next page, keep it 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 () // gets 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;
VaR value = getvalue (STR, "getactivitycountresult ");
Lblpostscount = value; // total number of records
Document. form1.pagectl1 _ select. Length = 0; // The initial drop-down box. The page number is displayed in 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 page functions:
Copy code The Code is as follows: function sd_web_pagectlgootherpage (pageno)
{
Getactivitylist (pageno );
}