ASP里调用数据如何控制图片每行显示为3个
Response.Write"<tablewidth='100%'border='0'cellspacing='5'cellpadding='0'class='Index...
Response.Write"<table width='100%' border='0' cellspacing='5' cellpadding='0' class='Index-Center4'>"
if request.querystring("page")="" then
ipagecurrent=1
else
ipagecurrent=cint(request.querystring("page"))
end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.pagesize = 4
rs.cachesize = 4
rs.open sql,conn,1,1
ipagecount = rs.pagecount
If ipagecurrent > ipagecount Then ipagecurrent = ipagecount
If ipagecurrent < 1 Then ipagecurrent = 1
if ipagecount=0 then
response.write"<tr><td align='center'>对不起!暂时还没发布任何形象代言人照片!</td></tr>"
else
rs.absolutepage = ipagecurrent
irecordsshown = 0
do while irecordsshown<6 and NOT rs.EOF
Response.Write"<tr>"
Response.Write"<td width='50%'>"
if not rs.eof then
'=========
'set RsTrue = server.createobject("adodb.recordset")
'RsTrue.open "select GroupLevel from Nweb_UGroup where GroupID='"&Rs("GroupID")&"'",conn,1,1
'GroupLevel=RsTrue("GroupLevel")
'RsTrue.Close
'set RsTrue=nothing
'if Session("GroupLevel")="" then Session("GroupLevel")=0
LL=Rs("LL")
'=========
Response.Write"<table cellpadding='0' cellspacing='2' style='border-top:'><tr><td align='center'><a href='Display.asp?id="&rs("id")&"' target='_blank'><img src="&LL&" border=0 onload=javascript:DrawImage(this);></a></td>"
Response.Write"</tr>"
Response.Write"</table></td>"
irecordsshown = irecordsshown +1
rs.movenext
end if
Response.Write"<td width='50%'>"
if not rs.eof then
'=========
'set RsTrue = server.createobject("adodb.recordset")
'RsTrue.open "select GroupLevel from Nweb_UGroup where GroupID='"&Rs("GroupID")&"'",conn,1,1
'GroupLevel=RsTrue("GroupLevel")
'RsTrue.Close
'set RsTrue=nothing
'if Session("GroupLevel")="" then Session("GroupLevel")=0
LL=Rs("LL")
'=========
Response.Write"<table cellpadding='0' cellspacing='2' style='border-top:'><tr><td align='center'><a href='Display.asp?id="&rs("id")&"' target='_blank'><img src="&LL&" border=0 onload=javascript:DrawImage(this);></a></td>"
Response.Write"</tr>"
Response.Write"</table></td>"
irecordsshown = irecordsshown +1
rs.movenext
end if
Response.Write"</tr>"
loop
end if
irecordcount=rs.recordcount
rs.Close
set rs=nothing
Response.Write"</table>"
ProductsShu=4
%> 展开
if request.querystring("page")="" then
ipagecurrent=1
else
ipagecurrent=cint(request.querystring("page"))
end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.pagesize = 4
rs.cachesize = 4
rs.open sql,conn,1,1
ipagecount = rs.pagecount
If ipagecurrent > ipagecount Then ipagecurrent = ipagecount
If ipagecurrent < 1 Then ipagecurrent = 1
if ipagecount=0 then
response.write"<tr><td align='center'>对不起!暂时还没发布任何形象代言人照片!</td></tr>"
else
rs.absolutepage = ipagecurrent
irecordsshown = 0
do while irecordsshown<6 and NOT rs.EOF
Response.Write"<tr>"
Response.Write"<td width='50%'>"
if not rs.eof then
'=========
'set RsTrue = server.createobject("adodb.recordset")
'RsTrue.open "select GroupLevel from Nweb_UGroup where GroupID='"&Rs("GroupID")&"'",conn,1,1
'GroupLevel=RsTrue("GroupLevel")
'RsTrue.Close
'set RsTrue=nothing
'if Session("GroupLevel")="" then Session("GroupLevel")=0
LL=Rs("LL")
'=========
Response.Write"<table cellpadding='0' cellspacing='2' style='border-top:'><tr><td align='center'><a href='Display.asp?id="&rs("id")&"' target='_blank'><img src="&LL&" border=0 onload=javascript:DrawImage(this);></a></td>"
Response.Write"</tr>"
Response.Write"</table></td>"
irecordsshown = irecordsshown +1
rs.movenext
end if
Response.Write"<td width='50%'>"
if not rs.eof then
'=========
'set RsTrue = server.createobject("adodb.recordset")
'RsTrue.open "select GroupLevel from Nweb_UGroup where GroupID='"&Rs("GroupID")&"'",conn,1,1
'GroupLevel=RsTrue("GroupLevel")
'RsTrue.Close
'set RsTrue=nothing
'if Session("GroupLevel")="" then Session("GroupLevel")=0
LL=Rs("LL")
'=========
Response.Write"<table cellpadding='0' cellspacing='2' style='border-top:'><tr><td align='center'><a href='Display.asp?id="&rs("id")&"' target='_blank'><img src="&LL&" border=0 onload=javascript:DrawImage(this);></a></td>"
Response.Write"</tr>"
Response.Write"</table></td>"
irecordsshown = irecordsshown +1
rs.movenext
end if
Response.Write"</tr>"
loop
end if
irecordcount=rs.recordcount
rs.Close
set rs=nothing
Response.Write"</table>"
ProductsShu=4
%> 展开
3个回答
展开全部
这样在网速慢的时候查出来会很慢,
可以用css+div来实现
-css-
.tt{width="90px;"}
.tt ul{width="90px;"}
.tt li{width="30px; margin:5px 5px 5px 5px;"}
-asp-
<div class="tt">
<ul>
<%while not rs.eof%>
<li><img src="<%rs("path")%>" /></li>
<%
rs.movenext
next
%>
</ul>
</div>
图片间的距离可以用margin:0 0 0 0;控制图片的间距,(上,右,下,左)
可以用css+div来实现
-css-
.tt{width="90px;"}
.tt ul{width="90px;"}
.tt li{width="30px; margin:5px 5px 5px 5px;"}
-asp-
<div class="tt">
<ul>
<%while not rs.eof%>
<li><img src="<%rs("path")%>" /></li>
<%
rs.movenext
next
%>
</ul>
</div>
图片间的距离可以用margin:0 0 0 0;控制图片的间距,(上,右,下,左)
展开全部
每行三个,可以参考一下:
<table>
<%while not rs.eof%>
<tr>
<%for i=1 to 3%>
<td>图片代码<%=i%></td>
<%
rs.movenext
next
%>
</tr>
<%
wend
%>
</table>
<table>
<%while not rs.eof%>
<tr>
<%for i=1 to 3%>
<td>图片代码<%=i%></td>
<%
rs.movenext
next
%>
</tr>
<%
wend
%>
</table>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
i=0
while not rs.eof then
<td>
i=i+1
if i/3=int(i/3) then response.write "</tr><tr>"
<td>
rs.movenext
wend
end if
while not rs.eof then
<td>
i=i+1
if i/3=int(i/3) then response.write "</tr><tr>"
<td>
rs.movenext
wend
end if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询