ASP分页前后十页和判断是否超出范围返回最后一页.100分求助

发布网友

我来回答

2个回答

热心网友

if (p*10+currentpage)>1 then
response.write "<div class='button'><a href='?currentpage=1&p=0"&mycondition&"' title='首页'><img src='images/btn_previouspage.gif'></a></div>"
end if
'===首页
if p>0 and currentpage=1 then
response.write "<div class='button'><a href='?currentpage=10&p="&p-1&mycondition&" title='上一页'><img src='images/btn_uppage.gif'></a></div>"
elseif currentpage>1 then
response.write "<div class='button'><a href='?currentpage="&currentpage-1&"&p="&p&mycondition&" title='上一页'><img src='images/btn_uppage.gif'></a></div>"
end if
'===上页
response.write "<ul class='pagetab'>" if p>0 then
response.write "<li><a href='?currentpage=10&p="&p-1&mycondition&"' title='上十页'>上十页</a></li>"
end if
'-------------------下面写出当前十个页码
for i=1 to 10
if (p*10+i)>pages then exit for
if currentpage=i then
response.write "<li class='current'><a "
else
response.write "<li><a "
end if
response.write "href='?currentpage="&i&"&p="&p&mycondition&"' title='第"&(p*10+i)&"页'>"&(p*10+i)&"</a></li>"
next
'--------------------察看下十页的连接
if (p*10+10)<pages then
response.write "<a href='?currentpage=1&p="&p+1&mycondition&"' title='下十页'>下十页</a>"
end if

'判断分页最后一位要是到最后一页则隐藏显示最后一页开始
if (p*10+currentpage)<pages then
'显示最后一页数字开始
response.write "<li><a href='?currentpage="&((pages-1) mod 10)+1&"&p="&((pages-1)\10)&mycondition&"'>.."&Pages&"</a></li>"
'显示最后一页数字结束
end if
'判断分页最后一位要是到最后一页则隐藏显示最后一页结束
'-----------------------------------------------上下页导航
response.write "</ul>" if (p*10+currentpage)<pages and currentpage=10 then
response.write "<div class='button'><a href='?currentpage=1&p="&p+1&mycondition&"' title='下一页'><img src='images/btn_dowmpage.gif'></a></div>"
elseif (p*10+currentpage)<pages then
response.write "<div class='button'><a href='?currentpage="&currentpage+1&"&p="&p&mycondition&"' title='下一页'><img src='images/btn_dowmpage.gif'></a></div>"
end if
'===下页 if (p*10+currentpage)<pages then
response.write "<div class='button'><a href='?currentpage="&((pages-1) mod 10)+1&"&p="&((pages-1)\10)&mycondition&"' title='尾页'><img src='images/btn_dowmpreviouspage.gif'></a></div>"
end if
'===尾页end sub

热心网友

因为mysql里有limit 从几开始,取多少条数据。。。mssql没有。。。
可以这样实现select top 10 * from tablename where id>0 and id<10

把10作为变量,那就是这样select top a * from tablename where id>a-10 and id<a

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com