ASP分页代码有错,谁能帮我改一下?急!
症状:点击分页链接根本就是毫无头绪的到处乱跳转!晕死了!<!------------------------------------------------------分...
症状:点击分页链接根本就是毫无头绪的到处乱跳转!晕死了!
<!------------------------------------------------------分页开始----------------------------------------->
<br>
共<%=rs1.recordcount%>个产品 共<%=pagemax%>页 / 第<%=pagenum%>页
<%if pagenum>1 and rs1.pagecount>1 then%>
【<a href="?ClassID=<%=request("ClassID")%>&pagenum=1">首页</a>】 【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=pagenum-1%>">上页</a>】
<%else%>
首页 上页
<%end if%>
<%if pagenum < trim(rs1.pagecount) and rs1.pagecount>1 then%>
【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=pagenum+1%>">下页</a>】 【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=rs1.pagecount%>">尾页</a>】
<%else%>
下页 尾页
<%end if%>
第
<select onChange="if(this.options[this.selectedIndex].value!=''){window.open(this.options[this.selectedIndex].value,'_self');}"
name="menu1">
<%For j = 1 to pagemax %>
<option value="?ClassID=<%=request("ClassID")%>&pagenum=<%=j%>" <%if j=pagenum then%>selected<%end if%>><%=j%></option>
<%next%>
</select>
页 <br>
<br>
<!----------------------------------------------------分页结束----------------------------------------->
我是用分页菜单的分页代码,代码在大类可以正常使用,但是到了子类以下级联分页代码就不能用了!
演示地址:http://www.min163.net/root/product_team.asp?ClassID=18&ClassBID=219 展开
<!------------------------------------------------------分页开始----------------------------------------->
<br>
共<%=rs1.recordcount%>个产品 共<%=pagemax%>页 / 第<%=pagenum%>页
<%if pagenum>1 and rs1.pagecount>1 then%>
【<a href="?ClassID=<%=request("ClassID")%>&pagenum=1">首页</a>】 【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=pagenum-1%>">上页</a>】
<%else%>
首页 上页
<%end if%>
<%if pagenum < trim(rs1.pagecount) and rs1.pagecount>1 then%>
【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=pagenum+1%>">下页</a>】 【<a href="?ClassID=<%=request("ClassID")%>&pagenum=<%=rs1.pagecount%>">尾页</a>】
<%else%>
下页 尾页
<%end if%>
第
<select onChange="if(this.options[this.selectedIndex].value!=''){window.open(this.options[this.selectedIndex].value,'_self');}"
name="menu1">
<%For j = 1 to pagemax %>
<option value="?ClassID=<%=request("ClassID")%>&pagenum=<%=j%>" <%if j=pagenum then%>selected<%end if%>><%=j%></option>
<%next%>
</select>
页 <br>
<br>
<!----------------------------------------------------分页结束----------------------------------------->
我是用分页菜单的分页代码,代码在大类可以正常使用,但是到了子类以下级联分页代码就不能用了!
演示地址:http://www.min163.net/root/product_team.asp?ClassID=18&ClassBID=219 展开
3个回答
展开全部
此程序一共三部份,1打开记录集 中间循换 翻页 我一直都是用的这个!!很不错
set RsP = server.createobject("adodb.recordset")
PSQL= "select id,Newtitle,addtime from News where TreeID like '%"&ID&"%' and Putout=true order by id desc"
RsP.PageSize = 20 '这里设定每页显示的记录数
RsP.CursorLocation = 3
RsP.Open PSQL,conn,0,2,1
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page)>=RsP.PageCount then
intpage = RsP.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not RsP.eof then
RsP.AbsolutePage = intpage
end if
if RsP.Bof or Rsp.EOF then ContentList="还没有相关内容!"
for i=1 to RsP.PageSize
if RsP.EOF or RsP.BOF then exit for
'此处是循环输出代码
next
'下面是翻页代码
response.write"<table width='100%' border='0' cellpadding='0' cellspacing='0' class='Pagination'><tr valign='middle'>"
if RsP.pagecount>0 then
response.write" <td height='24' align='center'>当前页"&intpage&"/"&RsP.PageCount&" "
else
response.write"<td height='24' align='center'>当前页0/0 "
end if
response.write"共有"&RsP.recordcount&"条信息 每页"&RsP.PageSize&"条 <a href='newslist.asp?page=1&id="&ID&"'>首页</a> | "
if pre then
response.write"<a href='newslist.asp?page="&intpage -1&"'>上页</a> | "
end if
if last then
response.write"<a href='newslist.asp?page="&intpage +1&"'>下页</a> | "
end if
response.write"<a href='newslist.asp?page="&RsP.PageCount&"'>尾页</a> | 转到第"
response.write"<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'>"
for i = 1 to RsP.PageCount
if i = intpage then
response.write"<option value='newslist.asp?page="&i&"' selected>"&i&"</option>"
else
response.write"<option value='newslist.asp?page="&i&"'>"&i&"</option>"
end if
next
response.write"</select>页</td></tr></table>"
RsP.Close
set RsP=nothing
set RsP = server.createobject("adodb.recordset")
PSQL= "select id,Newtitle,addtime from News where TreeID like '%"&ID&"%' and Putout=true order by id desc"
RsP.PageSize = 20 '这里设定每页显示的记录数
RsP.CursorLocation = 3
RsP.Open PSQL,conn,0,2,1
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page)>=RsP.PageCount then
intpage = RsP.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not RsP.eof then
RsP.AbsolutePage = intpage
end if
if RsP.Bof or Rsp.EOF then ContentList="还没有相关内容!"
for i=1 to RsP.PageSize
if RsP.EOF or RsP.BOF then exit for
'此处是循环输出代码
next
'下面是翻页代码
response.write"<table width='100%' border='0' cellpadding='0' cellspacing='0' class='Pagination'><tr valign='middle'>"
if RsP.pagecount>0 then
response.write" <td height='24' align='center'>当前页"&intpage&"/"&RsP.PageCount&" "
else
response.write"<td height='24' align='center'>当前页0/0 "
end if
response.write"共有"&RsP.recordcount&"条信息 每页"&RsP.PageSize&"条 <a href='newslist.asp?page=1&id="&ID&"'>首页</a> | "
if pre then
response.write"<a href='newslist.asp?page="&intpage -1&"'>上页</a> | "
end if
if last then
response.write"<a href='newslist.asp?page="&intpage +1&"'>下页</a> | "
end if
response.write"<a href='newslist.asp?page="&RsP.PageCount&"'>尾页</a> | 转到第"
response.write"<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'>"
for i = 1 to RsP.PageCount
if i = intpage then
response.write"<option value='newslist.asp?page="&i&"' selected>"&i&"</option>"
else
response.write"<option value='newslist.asp?page="&i&"'>"&i&"</option>"
end if
next
response.write"</select>页</td></tr></table>"
RsP.Close
set RsP=nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询