网页制作ASP问题!我的图片是每行只显示1个,怎么样能变成每行显示4个
<tablewidth="100%"height="142"border="0"align="center"cellpadding="0"cellspacing="0">...
<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=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For i=1 To x
%>
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="40%"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="121" height="47"><div 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%>
</div></td>
</tr>
</table>
<div align="center"><a href="tpyx.asp" class="nextlink"><%=rs("bookname")%></a></div></td>
</tr>
</table>
<span class="z2">
<%rs.movenext
next
'call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
end if
rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
.........................
....... 展开
<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=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For i=1 To x
%>
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="40%"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="121" height="47"><div 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%>
</div></td>
</tr>
</table>
<div align="center"><a href="tpyx.asp" class="nextlink"><%=rs("bookname")%></a></div></td>
</tr>
</table>
<span class="z2">
<%rs.movenext
next
'call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
end if
rs.close
set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
.........................
....... 展开
展开全部
曾经,我以为我是最喜欢用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
response.write "</tr><tr>"
End If
rs.movenext
next
%>
你这段代码也太凌乱了,我把里面抽出来一段写了一个一行显示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
response.write "</tr><tr>"
End If
rs.movenext
next
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询