asp求大神帮忙看看下面的代码,怎么实现 数据横4自动换行、并实现分页功能
下面代码有分页功能、、数据竖着显示(横1换行)、、求大神帮忙困扰我好几天了<body><!--#includefile="conn1.asp"--><tableborde...
下面代码有分页功能、、数据竖着显示(横1换行)、、求大神帮忙 困扰我好几天了
<body>
<!--#include file="conn1.asp" -->
<table border="0.5" width="100%">
<tr>
<%
Set Rsc=Server.CreateObject("ADODB.RecordSet")
SqlStr="select*from shu"
Rsc.Open SqlStr,conn,1,1
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
urlstr = "" '设置分页链接字符串
If Page <> 1 Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=1>第一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page-1) & ">上一页</A>"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page+1) & ">下一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page="& rsc.PageCount & ">最后一页</A>"
End If
'urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount
rsc.AbsolutePage = Page
%>
<%
If Not rsc.eof Then
For iPage = 1 To rsc.PageSize
%>
<td>
<table width="200" border="0.5">
----内容区------------------------------------------------------------------是个3行2列的表格、数据在表格中
</table>
</td>
<%
rsc.MoveNext
If rsc.EOF Then Exit For
Next
End If
%>
</tr>
</table>
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC"><%=urlstr%></td>
</tr>
</table> 展开
<body>
<!--#include file="conn1.asp" -->
<table border="0.5" width="100%">
<tr>
<%
Set Rsc=Server.CreateObject("ADODB.RecordSet")
SqlStr="select*from shu"
Rsc.Open SqlStr,conn,1,1
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
urlstr = "" '设置分页链接字符串
If Page <> 1 Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=1>第一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page-1) & ">上一页</A>"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page+1) & ">下一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page="& rsc.PageCount & ">最后一页</A>"
End If
'urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount
rsc.AbsolutePage = Page
%>
<%
If Not rsc.eof Then
For iPage = 1 To rsc.PageSize
%>
<td>
<table width="200" border="0.5">
----内容区------------------------------------------------------------------是个3行2列的表格、数据在表格中
</table>
</td>
<%
rsc.MoveNext
If rsc.EOF Then Exit For
Next
End If
%>
</tr>
</table>
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC"><%=urlstr%></td>
</tr>
</table> 展开
1个回答
展开全部
不太理解你说的横4换行的说法??是你数据还放在三行两列的表格,,然后一行显示4次后在换tr行进行下一次4遍显示吗??如果是的话要从新调整下,你要把外面的tr先去掉也假如for循环判断就可以了,修改调整如下,具体还是得结合演示测试修改:
<body>
<!--#include file="conn1.asp" -->
<table border="0.5" width="100%">
<tr>//这里不要了111
<%
Set Rsc=Server.CreateObject("ADODB.RecordSet")
SqlStr="select*from shu"
Rsc.Open SqlStr,conn,1,1
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
urlstr = "" '设置分页链接字符串
If Page <> 1 Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=1>第一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page-1) & ">上一页</A>"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page+1) & ">下一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page="& rsc.PageCount & ">最后一页</A>"
End If
'urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount
rsc.AbsolutePage = Page
%>
<%
If Not rsc.eof Then response.write("<tr>") '移动到这里111-1
For iPage = 1 To rsc.PageSize
%>
<td>
<table width="200" border="0.5">
----内容区------------------------------------------------------------------是个3行2列的表格、数据在表格中
</table>
</td>
<%if iPage mod 4 = 0 then response.write("</tr><tr><td height='10'></td></tr><tr>") '判断,关闭/tr另起一行tr
rsc.MoveNext
If rsc.EOF Then Exit For
Nextresponse.write("</tr>>") '闭合tr我写在这里看的比较直观222-1,个人习惯,也可以外面的111和222保留,111-1和222-1去掉就好。。
End If
%>
</tr>//不要了222
</table>
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC"><%=urlstr%></td>
</tr>
</table>
<body>
<!--#include file="conn1.asp" -->
<table border="0.5" width="100%">
<tr>//这里不要了111
<%
Set Rsc=Server.CreateObject("ADODB.RecordSet")
SqlStr="select*from shu"
Rsc.Open SqlStr,conn,1,1
rsc.PageSize = 20 'pagesize属性指定了每页要显示的记录条数
Page = CLng(Request("Page")) 'string型转化为long型
If Page < 1 Then Page = 1
If Page > rsc.PageCount Then Page = rsc.PageCount
urlstr = "" '设置分页链接字符串
If Page <> 1 Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=1>第一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page-1) & ">上一页</A>"
End If
If Page <> rsc.PageCount Then
urlstr = urlstr & "<A HREF=shu11.asp?Page=" & (Page+1) & ">下一页</A>"
urlstr = urlstr & "<A HREF=shu11.asp?Page="& rsc.PageCount & ">最后一页</A>"
End If
'urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount & "</center><table border=0>"
urlstr = urlstr & "页码:" & Page & "/" & rsc.PageCount
rsc.AbsolutePage = Page
%>
<%
If Not rsc.eof Then response.write("<tr>") '移动到这里111-1
For iPage = 1 To rsc.PageSize
%>
<td>
<table width="200" border="0.5">
----内容区------------------------------------------------------------------是个3行2列的表格、数据在表格中
</table>
</td>
<%if iPage mod 4 = 0 then response.write("</tr><tr><td height='10'></td></tr><tr>") '判断,关闭/tr另起一行tr
rsc.MoveNext
If rsc.EOF Then Exit For
Nextresponse.write("</tr>>") '闭合tr我写在这里看的比较直观222-1,个人习惯,也可以外面的111和222保留,111-1和222-1去掉就好。。
End If
%>
</tr>//不要了222
</table>
<table width="100%" border="1" bordercolor="#FFFFFF">
<tr>
<td width="100%" bordercolor="#CCCCCC"><%=urlstr%></td>
</tr>
</table>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询