Programming | Page <p><%maxperpage=8 ' defines the maximum number of records to 8<br>
If not IsEmpty (Request ("page") then <br>
Currentpage=cint (Request ("page")) ' currentpage us as the current page variable, get the current page value <br>
Else<br>
Currentpage=1 ' If empty, set to 1<br>
End If<br>
Sql= "SELECT * from article ORDER BY ID DESC" SQL statement, querying all data in article table <br>
Set rs= Server.CreateObject ("ADODB.") Recordset ") <br>
Rs.Open sql,conn,1,1 ' Execute SQL statement <br>
If rs.eof and Rs.bof then <br>
Response.Write "<p align= ' center ' > hasn't had any articles </p>" <br>
else <br>
Totalput=rs.recordcount ' The value of the query to the total number of articles is paid to Totalput variable (set first page) <br>
If Currentpage<1 then ' if less than 1<br>
Currentpage=1 <br>
End If <br>
if (currentpage-1) *maxperpage>totalput then ' set last page, if there is overflow, calculate page value <br>
if (totalput mod maxperpage) =0 then <br>
currentpage= totalput \ Maxperpage <br>
else <br>
Currentpage= totalput \ Maxperpage + 1 <br>
End If <br>
End If<br>
If Currentpage=1 then ' if is the first page <br>
ShowPage totalput,maxperpage, "index.asp" performs showpage function, showing pagination <br>
Showcontent ' Perform showcontent function, display content <br>
ShowPage totalput,maxperpage, "index.asp" performs showpage function, showing pagination <br>
Else ' if not <br>
if (currentPage-1) *maxperpage<totalput Then ' current page * page maximum number of records is greater than the actual total record number <br>
Rs.move (currentPage-1) *maxperpage ' Moves the record pointer to the beginning of the current page <br>
Dim Bookmark <br>
Bookmark=rs.bookmark <br>
ShowPage totalput,maxperpage, "index.asp" <br>
Showcontent <br>
ShowPage totalput,maxperpage, "index.asp" <br>
else <br>
Currentpage=1 <br>
ShowPage totalput,maxperpage, "index.asp" <br>
Showcontent <br>
ShowPage totalput,maxperpage, "index.asp" <br>
End If <br>
End If <br>
Rs.close <br>
End If <br>
Set Rs=nothing <br>
%></p>
<p><%function showpage (totalnumber,maxperpage,filename) <br>
<br>
Dim n <br>
If Totalnumber mod maxperpage=0 then <br>
n= totalnumber \ Maxperpage <br>
else <br>
n= totalnumber \ maxperpage+1 <br>
End If <br>
Response.Write "<form method=post action=" &filename& "typeid=" &typeid& ">" <br>
Response.Write "<p align= ' center ' >>> pagination" <br>
If Currentpage<2 then <br>
Response.Write "<font color= ' 999966 ' > Home prev </font>" <br>
else <br>
Response.Write "<a href=" &filename& "typeid=" &typeid& "&page=1&> home </a>" <br >
Response.Write "<a
href= "&filename&" typeid= "&typeid&" &page= "&CurrentPage-1&" > Previous page </a> "<br >
End If <br>
If N-currentpage<1 then <br>
Response.Write "<font color= ' 999966 ' > Next End </font>" <br>
else <br>
Response.Write "<a href=" &filename& "typeid=" &typeid& "&page=" & (Currentpage+1)
<br>
Response.Write "> next page </a> <a
href= "&filename&" "typeid=" &typeid& "&page=" &n& "> End </a>" <br>
End If <br>
Response.Write Page: <strong><font
Color=red> "&CurrentPage&" </font>/"&n&" </strong> page <br>
Response.Write "<b>" &totalnumber& "</b> flash<b>" &maxperpage& "</b> software/page "
<br>
Response.Write "goto: <input type= ' text ' name= ' page ' size=4
Class=smallinput value= "¤tpage&" > "<br>
Response.Write "<input class=buttonface type= ' Submit ' value= ' OK '
Name= ' Cndok ' ></span></p></form> ' <br>
End Function%></p>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.