标题:asp横排显示问题
只看楼主
玉树临风
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2006-11-7
 问题点数:0 回复次数:3 
asp横排显示问题
请教一个asp横排现实记录问题:

大家先看这段代码:
<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="25" align="center" class="news_ms_font">国际线路</td>
</tr>
<tr>
<td height="51" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from xljss order by id"
rs.open sql,conn,1,1
if not rs.eof then
i=1
do while not rs.eof
%>
<td align="left" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="xljs_show2.asp?id=<%=rs("id")%>" target="_blank"><%=rs("line2")%></a></td>
</tr>
</table></td>
<%if i mod 9=0 then%>
</tr>
<%
end if
rs.movenext
i=i+1
loop
rs.close
set rs=nothing
%>
</table>
<%end if%></td>
</tr>
</table>

我这样写完了。就出现下面的显示结果:

请帮忙怎么处理
搜索更多相关主题的帖子: asp 
2006-11-18 00:23
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
得分:0 
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from xljss order by id"
rs.open sql,conn,1,1
if not rs.eof then
i=0
do while not rs.eof
%>
<td align="left" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="xljs_show2.asp?id=<%=rs("id")%>" target="_blank"><%=rs("line2")%></a></td>
</tr>
</table></td>
<%
i=i+1
if i mod 9 = 0 then response.write("</tr><tr>")
rs.movenext

loop
rs.close
set rs=nothing
%>

i=i+1这个变量递增最好要写在判断和RS指针下移的代码之前


其实我很低调,只是你不知道...
2006-11-18 09:18
玉树临风
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2006-11-7
得分:0 
asp横排显示问题

非常感谢您的帮助。您在帮忙看看:文字排列确实很整齐了,但是每个字段之间的间距太宽了,记录够18个就换行。换行的那排不能实现左对齐。具体还应该怎么调整呢?

<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" align="center" class="news_ms_font">省内短线</td>
</tr>
<tr>
<td height="51" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from xljss order by id"
rs.open sql,conn,1,1
if not rs.eof then
i=0
do while not rs.eof
%>
<td align="left" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><a href="xljs_show1.asp?id=<%=rs("id")%>" target="_blank"><%=rs("line1")%></a></td>
</tr>
</table>
</td>
<%
i=i+1
if i mod 6 = 0 then response.write("</tr><tr>")
rs.movenext
loop
rs.close
set rs=nothing
%>

</tr>
</table>
<% end if %>
</td>
</tr>
</table>
<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="25" align="center" class="news_ms_font">国际线路</td>
</tr>
<tr>
<td height="51" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from xljss order by id"
rs.open sql,conn,1,1
if not rs.eof then
i=0
do while not rs.eof
%>

<td align="left" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><a href="xljs_show2.asp?id=<%=rs("id")%>" target="_blank"><%=rs("line2")%></a></td>
</tr>
</table></td>
<%
i=i+1
if i mod 6 = 0 then response.write("</tr><tr>")
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
<%end if%></td>
</tr>
</table>
<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="25" align="center" class="news_ms_font">国内线路</td>
</tr>
<tr>
<td height="51" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from xljss order by id"
rs.open sql,conn,1,1
if not rs.eof then
i=0
do while not rs.eof
%>
<td align="left" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><a href="xljs_show3.asp?id=<%=rs("id")%>" target="_blank"><%=rs("line3")%></a></td>
</tr>
</table></td>
<%
i=i+1
if i mod 6 = 0 then response.write("</tr><tr>")
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
<%end if%>
</td>
</tr>
</table>


2006-11-18 14:41
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
得分:0 

那就要调整你循环的<td>的宽高和对齐属性了


其实我很低调,只是你不知道...
2006-11-18 15:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-103738-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.347146 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved