asp 数据库查询后显示,如何自动换行?
解决时间 2021-08-15 21:25
- 提问者网友:你挡着我发光了
- 2021-08-15 02:36
下面的代码能够显示出现,都是竖着显示,。我想让他横着排后,每排显示5个就换行,如何修改下面的代码
<%
With Rs
.Open"Select * From B_About Where Type='qikan' Order By [Order] desc",Conn(),1,1
For i=1 To .Recordcount
If .Eof Then Exit For
%>
<table width="150" height="27" border="0" cellpadding="0" cellspacing="0" background="images/gk3.jpg" onmouseover="change(this.id,'images/gk2.jpg')" onmouseout="change2(this.id,'images/gk3.jpg')" class="xdh1" id="<%=Rs("ID")%>" >
<tr>
<td align="left" ><a href="qikan.asp?id=<%=Rs("ID")%>" class="jiaoshou"><%=Rs("Title")%></a></td>
</tr>
</table>
<%
.Movenext
Next
.Close
End With
%>
最佳答案
- 五星知识达人网友:枭雄戏美人
- 2021-08-15 03:50
<%
With Rs
.Open"Select * From B_About Where Type='qikan' Order By [Order] desc",Conn(),1,1
%>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<%
For i=1 To .Recordcount
If .Eof Then Exit For
%>
<td width="150" height="27" align="left" background="images/gk3.jpg"
onmouseover="change(this.id,'images/gk2.jpg')" onmouseout="change2(this.id,'images/gk3.jpg')" class="xdh1" id="<%=Rs("ID")%
>"><a href="qikan.asp?id=<%=Rs("ID")%>" class="jiaoshou"><%=Rs("Title")%></a></td>
<%
if i mod 5 =0 then
%>
</tr><tr>
<%
end if
.Movenext
Next
%>
</tr>
</table>
<%
.Close
End With
%>
全部回答
- 1楼网友:長槍戰八方
- 2021-08-15 06:45
<table cellpadding="0" cellspacing="0" width="100%" align="center"><!--这里的表格宽度你自己根据情况设定-->
<%
With Rs
.Open"Select * From B_About Where Type='qikan' Order By [Order] desc",Conn(),1,1
For i=1 To .Recordcount
If .Eof Then Exit For
If i mod 5=1 Then
%>
<tr>
<% End If %>
<td>
<table width="150" height="27" border="0" cellpadding="0" cellspacing="0" background="images/gk3.jpg" onmouseover="change(this.id,'images/gk2.jpg')" onmouseout="change2(this.id,'images/gk3.jpg')" class="xdh1" id="<%=Rs("ID")%>" >
<tr>
<td align="left" ><a href="qikan.asp?id=<%=Rs("ID")%>" class="jiaoshou"><%=Rs("Title")%></a></td>
</tr>
</table>
</td>
<%If i mod 5=0 Then%>
</tr>
<%
End If
.Movenext
Next
.Close
End With
%>
</table>
- 2楼网友:七十二街
- 2021-08-15 05:13
若每行显示5个,这样修改:
<table width="150" height="27" border="0" cellpadding="0" cellspacing="0" background="images/gk3.jpg" onmouseover="change(this.id,'images/gk2.jpg')" onmouseout="change2(this.id,'images/gk3.jpg')" class="xdh1" id="<%=Rs("ID")%>" >
<%
With Rs
.Open"Select * From B_About Where Type='qikan' Order By [Order] desc",Conn(),1,1
For i=1 To .Recordcount
If .Eof Then Exit For
If i mod 5=1 Then
%>
<tr>
<%End If%>
<td align="left" ><a href="qikan.asp?id=<%=Rs("ID")%>" class="jiaoshou"><%=Rs("Title")%></a></td>
<%If i mod 5=0 Then%>
</tr>
<%
End If
.Movenext
Next
.Close
End With
%>
</table>
我要举报
大家都在看
推荐资讯