ASP has been used for many tasks, but I have never paid attention to it. Today I have spent some time writing this item for future use.
<% Sub listpagemenu (objrs, intrspagesize)
Dim rstotal, rspagesize, rspagecount
If not isobject (objrs) Then exit Sub: end if
If not isnumeric (rspagesize) Then exit Sub: end if
If objrs. EOF and objrs. bof then exit Sub: end if
Objrs. pagesize = intrspagesize
Rstotal = objrs. recordcount
Rspagecount = Rs. pagecount
If rstotal <0 and (not (objrs. EOF and objrs. bof) then
Rstotal = 0
Do while not objrs. EOF
Rstotal = rstotal + 1
Objrs. movenext
Loop
End if
Intcurrentpage = trim (request. querystring ("page") 'Get the value of intcurrentpage
If intcurrentpage = "" or (not isnumeric (intcurrentpage) then
Intcurrentpage = 1
End if
Dim istart, Istop
Istart = 1: Istop = 1
If CINT (intCurrentPage-3)> 0 then
Istart = intCurrentPage-3
Else
Istart = 1
End if
Istop = istart + 7
If Istop> rspagecount then
Istop = rspagecount
End if
If iStop-7 <istart and istart> 0 then
Istart = iStop-7
End if
Dim strurl
Strurl = request. servervariables ("script_name ")
If instr (strurl ,"? ")> 0 then
Strurl = strurl & "& page ="
Else
Strurl = strurl &"? Page ="
End if
Dim previouspage, nextpage
If intCurrentPage-1> 0 then
Pre viouspage = intCurrentPage-1
Else
Previouspage = 1
End if
If intcurrentpage + 1 <rspagecount then
Nextpage = intcurrentpage + 1
Else
Nextpage = rspagecount
End if %>
<Table width = "98%" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<TD> <a href = "<% = strurl %> 1" style = "text-Decoration: none "> <font face =" webdings "> 9 </font> </a> </TD>
<TD> <a href = "<% = strurl & previouspage %>" style = "text-Decoration: none "> <font face =" webdings "> 7 </font> </a> </TD>
<TD>
<% Dim I
For I = istart to Istop step 1%>
<TD> <% response. write ("<a href = '" & strurl & I & "'style = 'text-Decoration: none'>" & I & "</a> ") %> </TD>
<% Next %>
</TD>
<TD> <a href = "<% = strurl & nextpage %>" style = "text-Decoration: none "> <font face =" webdings "> 8 </font> </a> </TD>
<TD> <a href = "<% = strurl & rspagecount %>" style = "text-Decoration: none"> <font face = "webdings">: </font> </a> </TD>
<TD> & nbsp; </TD>
<TD> & nbsp; </TD>
</Tr>
</Table>
<% End sub %>