请教ASP表格数据横向排列的问题

sbxkpl 2006-12-04 08:59:12
各位老大,我从数据库里取出数据做一个排列,想排成下列样式
图片 图片 图片
111 222 333

图片 图片
322 333


可是怎么排都成这样子了
图片111 图片222 图片333

图片322 图片333

我的代码如下,麻烦各位大哥帮小弟看一下
<table width="179" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.createobject("adodb.recordset")
sql= "select * from product where type='f' order by type desc"
rs.open sql,conn
if not rs.eof then
do while not rs.eof
%>
<td align="center" valign="middle"><a href="../manager<%=rs("pic")%>" border="0" target="_blank"><img src="../manager<%=rs("pic")%>" id="img1" width ="100" height="120" border="0"></a></td>
<td>· <a href="content.asp?productID=<%=rs("ID")%>" target="_blank"><%=rs("title")%></a></td>
<%
m=m+1
if m mod 4=0 then '//将m改为3就是每行3个,依次类推
response.write "</tr>"
end if
rs.movenext
loop
end if
' rs.close
%>
</table>
...全文
217 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
sujinlin 2006-12-06
  • 打赏
  • 举报
回复
div进行定位处理
baozheqiang 2006-12-05
  • 打赏
  • 举报
回复
写一个欠套的循环在里面,<br>换行就行了。
  if m mod 4=0 then '//将m改为3就是每行3个,依次类推
这么写,不推荐,看起来会晕的.
deiphi 2006-12-05
  • 打赏
  • 举报
回复
<style type="text/css">
.mytable{
float:left;
margin:8px;
}
</style>


for
<table class="mytable">
<tr>
<td>图片</td>
</tr>
<tr>
<td>文字</td>
</tr>
</table>
next
ekingquan 2006-12-05
  • 打赏
  • 举报
回复
我有一个笨笨的方法,把数据全部存到数组,再按你喜欢的方式排列显示
chessman_mak 2006-12-05
  • 打赏
  • 举报
回复
同意楼上说法, 应该写两个TR来控制.. 上面放图片,下面放内容.

试试吧...
<table width="179" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.createobject("adodb.recordset")
sql= "select * from product where type='f' order by type desc"
rs.open sql,conn
if not rs.eof then
do while not rs.eof
%>
<td align="center" valign="middle"><a href="../manager<%=rs("pic")%>" border="0" target="_blank"><img src="../manager<%=rs("pic")%>" id="img1" width ="100" height="120" border="0"></a></td></tr>
<tr><td>· <a href="content.asp?productID=<%=rs("ID")%>" target="_blank"><%=rs("title")%></a></td>
<%
m=m+1
if m mod 4=0 then '//将m改为3就是每行3个,依次类推
response.write "</tr>"
end if
rs.movenext
loop
end if
' rs.close
%>
</table>
sbxkpl 2006-12-05
  • 打赏
  • 举报
回复
还是不行,变成了下面的样子
图片
111

图片
222

图片
333

.......

如果在单元格里在个<table>,则变成了和上面的样子一样,而且只有四个数据可以显示
taia 2006-12-04
  • 打赏
  • 举报
回复
循环的每个单元格里再套一个表格,上面是图片,下面是内容

28,391

社区成员

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

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