Recently, the website was revised and found that the original page did not contain numbers, only the home page, the last page, the next page, and the select jump were all popular before, but now the most popular one is that the number page is in the middle, which is just researched and shared. Friends who need it can refer to it.
Effect:
Foreign core code:
The code copy is as follows:
<%
'digg style pagination script in asp.. written by Moazam... http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/
function getPaginationString(page, totalitems, limit, adjacents, targetpage)
'defaults
if not isnumeric(adjacents) then adjacents = 1 end if
if not isnumeric(limit) then limit = 15 end if
if not isnumeric(page) then page = 1 end if
if targetpage = "" then targetpage = "/" end if
margin = ""
padding=""
'other vars
prev = page - 1'previous page is page - 1
nextPage = page + 1'nextPage page is page + 1
lastpage = Ceil(totalitems , limit)'lastpage is = total items / items per page, rounded up.
lpm1 = lastpage - 1'last page minus 1
'Now we apply our rules and draw the pagination object.
'We're actually saving the code to a variable in case we want to draw it more than once.
pagination = ""
if lastpage > 1 then
pagination = pagination & "<divpagination"""
if margin <> "" OR padding <> "" then
pagination = pagination & " style="""
if margin <> "" then
pagination = pagination & "margin: margin"
end if
if padding <> "" then
pagination = pagination & "padding: padding"
end if
pagination = pagination & """"
end if
pagination = pagination & ">"
'previous button
if page > 1 then
pagination = pagination & "<a href="""&targetpage&"&page="&prev&""">Prev</a>"
else
pagination = pagination & "<spandisabled"">Prev</span>"
end if
'pages
if lastpage < 7 + (adjacents * 2) then'not enough pages to both breaking it up
for counter = 1 to lastpage
if counter = page then