Asp 每行显示图片个数 怎么改

来源:百度知道 编辑:UC知道 时间:2024/09/22 01:11:57
<!--#include file="../include/weburl.asp"-->
<!--#include file="../include/ubbcode.asp"-->
<!--#include file="../include/conn.asp"-->
<%
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"

set rs=server.CreateObject("adodb.recordset")
rs.open "select top 4 title,img,html from products order by id desc",conn,1,1
if not rs.eof then
do while not rs.eof

pro_list=pro_list&" <td width=""25%"" align=""center""><table width=""80%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <tr>"
pro_list=pro

你这样搞到头晕的。
这样:
<table>

<%
do while not rs.eof'循环所有按每行四个显示,如果你要显示两行,用for i= 1 to 2
%>

<tr>

<%
for i=1 to 4'每行显示四个
%>

<td>

<%response.write("你的输出数据")%>

</td>

<%
rs.movenext
if rs.eof then
exit for
end if
next
%>

</tr>

<%loop%>

</table>

如果你认为表格宽度不符,那就先设定好表格宽度再加入其中的ASP代码。

改为:
<!--#include file="../include/weburl.asp"-->
<!--#include file="../include/ubbcode.asp"-->
<!--#include file="../include/conn.asp"-->
<%
pro_list="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
pro_list=pro_list&" <t