网页制作ASP问题!我的图片是每行只显示1个,怎么样能变成每行显示4个

来源:百度知道 编辑:UC知道 时间:2024/06/03 12:15:21
<table width="100%" height="142" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="142" valign="top"><%
set rs=server.createobject("adodb.recordset")
rs.open "select * from nasuo_photo order by bookid desc",conn,1,3
if rs.recordcount=0 then
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center>暂无图片</td>
</tr>
</table>
<%
else
rs.PageSize =2 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize

曾经,我以为我是最喜欢用table的人,但是...遇到你以后,我甘拜下风:)

你这段代码也太凌乱了,我把里面抽出来一段写了一个一行显示4个图片的,希望能对你有所帮助:

<%
For i=1 To x
%>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
For i=0 To x
%>
<td width=150 align=center>
<%if rs("bookpic")<>"" then
response.write "<a href="&trim(rs("bookpic2"))&" target=_blank><img src="&trim(rs("bookpic"))&" width=140 height=110 border=0></a>"
else
response.write "<img src=images/emptybook.gif width=140 height=110 border=0>"
end if

response.write "<br>"
response.write "<a href='tpyx.asp' class='nextlink'>"&rs("bookname")&"</a>"
%>
</td>
<%
If i Mod 4 = 0 Then