for counter = 1 to lastpage
if counter = page then
pagination = pagination & "<span class=""current"">"&counter&"</span>"
else
pagination = pagination & "<a href="""&targetpage&""&"&page="&counter&""">"&counter&"</a>"
end if
next
elseif lastpage >= 7 + (adjacents * 2) then 'enough pages to hide some
'close to beginning only hide later pages
if page < 1 + (adjacents * 3) then
for counter = 1 to (4 + (adjacents * 2))-1
if counter = page then
pagination = pagination & "<span class=""current"">"&counter&"</span>"
else
pagination = pagination & "<a href="""&targetpage&"&page="&counter&""">"&counter&"</a>"
end if
next
pagination = pagination & "..."
pagination = pagination & "<a href="""&targetpage&""&"&page="&lpm1&""">"&lpm1&"</a>"
pagination = pagination & "<a href="""&targetpage&""&"&page="&lastpage&""">"&lastpage&"</a>"
'in middle hide some front and some back
elseif lastpage - (adjacents * 2) > page AND page > (adjacents * 2) then
pagination = pagination & "<a href="""&targetpage&"&page=1"">1</a>"
pagination = pagination & "<a href="""&targetpage&"&page=2"">2</a>"
pagination = pagination & "..."
for counter = (page - adjacents) to (page + adjacents)
if counter = page then
pagination = pagination & "<span class=""current"">"&counter&"</span>"
else
pagination = pagination & "<a href="""&targetpage&"&page="&counter&""">"&counter&"</a>"
end if
next
pagination = pagination & "..."
pagination = pagination & "<a href="""&targetpage&"&page="&lpm1&""">"&lpm1&"</a>"
pagination = pagination & "<a href="""&targetpage&"page="&lastpage&""">"&lastpage&"</a>"
ASP 数字分页效果代码(2)
内容版权声明:除非注明,否则皆为本站原创文章。