求asp网页实现“上一个,下一个”页面跳转效果“内详”

anyfily 2010-07-03 04:33:55
我想做一个产品页面,
假设现在观看的是
http://www.sohu.com/chanpin.asp?ID=976
那么下一个就是
http://www.sohu.com/chanpin.asp?ID=977
上一个就是
http://www.sohu.com/chanpin.asp?ID=975

我想在http://www.sohu.com/chanpin.asp加上“上一个下一个”的点击衔接实现+1-1的操作



如何通过超衔接的方式实现url跳转到上一个

我是这么写的
<th scope="col"><a href="Gm_Pros.asp?ID= ">下一个</a></th>

Gm_Pros.asp?ID= 后面要写什么就能实现http://www.sohu.com/chanpin.asp?ID=977减去1 = http://www.sohu.com/chanpin.asp?ID=976
跪求代码
跪求代码 跪求代码 跪求代码
...全文
134 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
oaskyking 2011-05-17
  • 打赏
  • 举报
回复
可以实现上一个,但是无法实现下一个啊。怎么办啊?
qwe7054782 2010-07-03
  • 打赏
  • 举报
回复
有这个函数
我刚加上的


<%
'定义一个nextrs函数来找出下一篇的ID  
function nextrs
nextrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from GYS_info where id>"&a1&" order by id"
set nextrsd=conn.execute(sql)
if nextrsd.eof then
response.Write "<input type='button' class='btn2' style='width:80px; height:18px' value='没有了' disabled>"
else
a2=nextrsd("id")
response.Write "<input type='button' class='btn2' style='width:80px; height:18px' value='下一位"&nextrsd("loginid")&"' onClick=window.location.href('gys_info_detail.asp?id="&a2&"')>"
end if
end function

'定义一个backrs函数来找出上一篇的ID
function backrs
backrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from GYS_info where id<"&a1&" order by id desc"
set backrsd=conn.execute(sql)
if backrsd.eof then
response.Write "<input type='button' class='btn2' style='width:80px; height:18px' value='没有了' disabled>"
else
a0=backrsd("id")
response.Write "<input type='button' class='btn2' style='width:80px; height:18px' value='上一位"&backrsd("loginid")&"' onClick=window.location.href('gys_info_detail.asp?id="&a0&"')>"

end if
end function


多给我点分吧 我每次下载东西都没分 555555555555555555555555555
anyfily 2010-07-03
  • 打赏
  • 举报
回复
同意楼上,我公司的mdb确实很乱,
jackjun119 2010-07-03
  • 打赏
  • 举报
回复
直接在地址参数里加1减不是真正的上下翻页,可能会出现跨越分类,进入id不存在的地址等等情况
应该先查询出排好序的符合条件的记录集,在记录集内部加减序号,建议用数组处理
anyfily 2010-07-03
  • 打赏
  • 举报
回复
<th scope="col"><a href="*.asp?ID=<%=ID -1%>">上一个</a></th>
<th scope="col"><a href="*.asp?ID=<%=ID +1%>">下一个</a></th>

先谢谢楼上两位,
两句话实现*.asp?IDx的跳转
lzp4881 2010-07-03
  • 打赏
  • 举报
回复
上一篇
sql="select top 1 * from 表 where id<"&request("id")&" order by id desc"


下一篇
sql="select top 1 * from 表 where id>"&request("id")&" order by id"
街头小贩 2010-07-03
  • 打赏
  • 举报
回复
分页代码在CSDN就有很多!自已去找一个不难吧

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧