ASP数据分页显示问题(看下面代码)
请问把下面的代码、怎么修改、、能让分页标签放在数据内容就是下面图片的第一行内容、、放到其他内容以后、、、求大神帮忙修改下<!--#includefile="conn.as...
请问把下面的代码、怎么修改、、能让分页标签放在数据内容
就是下面图片的第一行内容、、放到其他内容以后、、、求大神帮忙修改下
<!--#include file="conn.asp"-->
<%
set rsc=server.createobject("adodb.recordset")
sqlc="select * from xx "
rsc.open sqlc,conn,1,1
Response.write "<left>"
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
If Page <> 1 Then
Response.Write "<A HREF=xxxx.asp?Page=1>第一页</A>?"
Response.Write "<A HREF=xxxx.asp?Page=" & (Page-1) & ">上一页</A>?"
End If
If Page <> rsc.PageCount Then
Response.Write "<A HREF=xxxx.asp?Page=" & (Page+1) & ">下一页</A>?"
Response.Write "<A HREF=xxxx.asp?Page="& rsc.PageCount & ">最后一页</A>?"
End If
Response.write "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
rsc.AbsolutePage = Page '把页码赋给absolutepage属性从而知当前页的首条记录号
For iPage = 1 To rsc.PageSize
%>
<tr>
<td width="574" bordercolor="#CCCCCC" class="classlist"><div align="left" class="classlist"><span class="classlist"><a href="xxxs.asp?id=<%=rsc("xx_id")%>"><%=rsc("xx_title")%></a></span></div></td>
<%
rsc.MoveNext
If rsc.EOF Then Exit For
Next
%>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<br />
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC">
</td>
</tr>
</table>
</div>
<%
rsc.close
set rsc=nothing
conn.close
set conn=nothing
%> 展开
就是下面图片的第一行内容、、放到其他内容以后、、、求大神帮忙修改下
<!--#include file="conn.asp"-->
<%
set rsc=server.createobject("adodb.recordset")
sqlc="select * from xx "
rsc.open sqlc,conn,1,1
Response.write "<left>"
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
If Page <> 1 Then
Response.Write "<A HREF=xxxx.asp?Page=1>第一页</A>?"
Response.Write "<A HREF=xxxx.asp?Page=" & (Page-1) & ">上一页</A>?"
End If
If Page <> rsc.PageCount Then
Response.Write "<A HREF=xxxx.asp?Page=" & (Page+1) & ">下一页</A>?"
Response.Write "<A HREF=xxxx.asp?Page="& rsc.PageCount & ">最后一页</A>?"
End If
Response.write "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
rsc.AbsolutePage = Page '把页码赋给absolutepage属性从而知当前页的首条记录号
For iPage = 1 To rsc.PageSize
%>
<tr>
<td width="574" bordercolor="#CCCCCC" class="classlist"><div align="left" class="classlist"><span class="classlist"><a href="xxxs.asp?id=<%=rsc("xx_id")%>"><%=rsc("xx_title")%></a></span></div></td>
<%
rsc.MoveNext
If rsc.EOF Then Exit For
Next
%>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<br />
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC">
</td>
</tr>
</table>
</div>
<%
rsc.close
set rsc=nothing
conn.close
set conn=nothing
%> 展开
1个回答
展开全部
设置一个变量,将分页相关的内容存到变量里面,然后循环之后再用变量显示分页代码
urlstr = ""
If Page <> 1 Then
urlstr = urlstr & "<A HREF=xxxx.asp?Page=1>第一页</A>?"
urlstr = urlstr & "<A HREF=xxxx.asp?Page=" & (Page-1) & ">上一页</A>?"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & <A HREF=xxxx.asp?Page=" & (Page+1) & ">下一页</A>?"
urlstr = urlstr & <A HREF=xxxx.asp?Page="& rsc.PageCount & ">最后一页</A>?"
End If
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
循环之后:
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC">
<%=urlstr %>
</td>
</tr>
</table>
urlstr = ""
If Page <> 1 Then
urlstr = urlstr & "<A HREF=xxxx.asp?Page=1>第一页</A>?"
urlstr = urlstr & "<A HREF=xxxx.asp?Page=" & (Page-1) & ">上一页</A>?"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & <A HREF=xxxx.asp?Page=" & (Page+1) & ">下一页</A>?"
urlstr = urlstr & <A HREF=xxxx.asp?Page="& rsc.PageCount & ">最后一页</A>?"
End If
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
循环之后:
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC">
<%=urlstr %>
</td>
</tr>
</table>
更多追问追答
追问
能帮我合并一下吗?? 这分页问题困扰我好几天了
追答
在附件里面合并了,直接回复代码太难看了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询