效果:
代码:
url 提交的链接地址
do_rsCount 数据库记录
do_PageSize 每页显示记录
do_CurPage 当前页码
do_Pages 页码显示数
sub getpages(url,do_rsCount, do_PageSize, do_CurPage, do_Pages)
maxPage = fix ((do_rsCount - 1 ) / do_PageSize) + 1
writePages = " <div class='ipages'><nobr> "
prevBtn = do_CurPage - fix (do_Pages / 2 )
nextBtn = do_CurPage + fix (do_Pages / 2 )
if prevBtn <= 0 then
prevBtn = 1
nextBtn = do_Pages
end if
if nextBtn > maxPage then
nextBtn = maxPage
prevBtn = maxPage - do_Pages
end if
if prevBtn <= 0 then prevBtn = 1
if maxPage = 1 then
writePages = writePages & " <a href='javascript:void(0);' class=now>1</a> "
else
if prevBtn > 1 then writePages = writePages & " <a href= " & url & " pgno=1>首页</a> "
if do_CurPage > 1 then writePages = writePages & " <a href= " & url & " pgno= " & (do_CurPage - 1 ) & " >上一页</a> "
if prevBtn > 1 and maxPage > 1 then writePages = writePages & " ...... "
for i = prevBtn to nextBtn
if do_CurPage = i then
writePages = writePages & " <a href='javascript:void(0);' class=now> " & i & " </a> "
else
if i <= maxPage then
writePages = writePages & " <a href= " & url & " pgno= " & i & " > " & i & " </a> "
end if
end if
next
end if
if i <> maxPage + 1 and maxPage > 1 then
writePages = writePages & " ...... "
end if
if do_CurPage < maxPage then writePages = writePages & " <a href= " & url & " pgno= " & (do_CurPage + 1 ) & " >下一页</a> "
if nextBtn < maxPage then writePages = writePages & " <a href= " & url & " pgno= " & maxPage & " >末页</a> "
writePages = writePages & " </nobr></div> "
response.write writePages
end sub
do_rsCount 数据库记录
do_PageSize 每页显示记录
do_CurPage 当前页码
do_Pages 页码显示数
sub getpages(url,do_rsCount, do_PageSize, do_CurPage, do_Pages)
maxPage = fix ((do_rsCount - 1 ) / do_PageSize) + 1
writePages = " <div class='ipages'><nobr> "
prevBtn = do_CurPage - fix (do_Pages / 2 )
nextBtn = do_CurPage + fix (do_Pages / 2 )
if prevBtn <= 0 then
prevBtn = 1
nextBtn = do_Pages
end if
if nextBtn > maxPage then
nextBtn = maxPage
prevBtn = maxPage - do_Pages
end if
if prevBtn <= 0 then prevBtn = 1
if maxPage = 1 then
writePages = writePages & " <a href='javascript:void(0);' class=now>1</a> "
else
if prevBtn > 1 then writePages = writePages & " <a href= " & url & " pgno=1>首页</a> "
if do_CurPage > 1 then writePages = writePages & " <a href= " & url & " pgno= " & (do_CurPage - 1 ) & " >上一页</a> "
if prevBtn > 1 and maxPage > 1 then writePages = writePages & " ...... "
for i = prevBtn to nextBtn
if do_CurPage = i then
writePages = writePages & " <a href='javascript:void(0);' class=now> " & i & " </a> "
else
if i <= maxPage then
writePages = writePages & " <a href= " & url & " pgno= " & i & " > " & i & " </a> "
end if
end if
next
end if
if i <> maxPage + 1 and maxPage > 1 then
writePages = writePages & " ...... "
end if
if do_CurPage < maxPage then writePages = writePages & " <a href= " & url & " pgno= " & (do_CurPage + 1 ) & " >下一页</a> "
if nextBtn < maxPage then writePages = writePages & " <a href= " & url & " pgno= " & maxPage & " >末页</a> "
writePages = writePages & " </nobr></div> "
response.write writePages
end sub