asp代码 下一页不能跳转 高手请来
答案:2 悬赏:10
解决时间 2021-01-21 00:32
- 提问者网友:火车头
- 2021-01-20 03:08
asp代码 下一页不能跳转 高手请来
最佳答案
- 二级知识专家网友:摆渡翁
- 2021-01-20 03:26
这是我做的一个书网的分页显示,你可以参考一下,看能不能帮到你:
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from tushumeans order by productdate desc",conn,1,1//查询表中记录并排序
rs.pagesize=15//每页记录数
page11=request("page1") //获取page1的值
if page11="" then
page1=1
else
page1=page11
end if
if not rs.eof then
rs.absolutepage=page1//将page1的值设置为当前页
end if
%>
以下是动态输出数据:
<%
i=0
while i<3 and not rs.eof
%>
<%for j=1 to 5%>
">" width="117" height="117" border="0" />
"><%=rs(1)%>
市场价:¥ <%=rs(8)%>元
本店价:¥ <%=rs(9)%>元
">
<%rs.movenext
if rs.eof then
exit for
end if
next
%>
<%
i=i+1
wend
%>
判断分页:
<%
if page1<>1 then
%>//如果page1<>1则显示“第一页”的链接同时传空值
第一页
<%end if
if page1<>1 then
%> //如果page1<>1则显示“上一页”的链接同时传值给page1(“以下同理”)
">上一页
<%
end if
if instr(page1,cstr(rs.pagecount))=0 then
%>
">下一页
<%
end if
if instr(page1,cstr(rs.pagecount))=0 then
%>
">最后一页
<%end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from tushumeans order by productdate desc",conn,1,1//查询表中记录并排序
rs.pagesize=15//每页记录数
page11=request("page1") //获取page1的值
if page11="" then
page1=1
else
page1=page11
end if
if not rs.eof then
rs.absolutepage=page1//将page1的值设置为当前页
end if
%>
以下是动态输出数据:
<%
i=0
while i<3 and not rs.eof
%>
<%for j=1 to 5%>
">" width="117" height="117" border="0" />
市场价:¥ <%=rs(8)%>元
本店价:¥ <%=rs(9)%>元
">
<%rs.movenext
if rs.eof then
exit for
end if
next
%>
<%
i=i+1
wend
%>
判断分页:
<%
if page1<>1 then
%>//如果page1<>1则显示“第一页”的链接同时传空值
第一页
<%end if
if page1<>1 then
%> //如果page1<>1则显示“上一页”的链接同时传值给page1(“以下同理”)
">上一页
<%
end if
if instr(page1,cstr(rs.pagecount))=0 then
%>
">下一页
<%
end if
if instr(page1,cstr(rs.pagecount))=0 then
%>
">最后一页
<%end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
全部回答
- 1楼网友:雾月
- 2021-01-20 04:57
我暂时保留我的看法!
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯