ASP调出的图片怎么换行成一行4个,然后换行?

能不能用这个代码修改呢?x=trim(request("x"))y=trim(request("y"))w=trim(request("w"))h=trim(reques... 能不能用这个代码修改呢?
x=trim(request("x"))
y=trim(request("y"))
w=trim(request("w"))
h=trim(request("h"))
n=trim(request("n"))
lm2=trim(request("lm2"))
tj=trim(request("tj"))
if lm2="" then lm2=trim(request("lm"))
if n="" then n=20
n=int(n)
open=trim(request("open"))
font=trim(request("font"))
if (not isNumeric(TJ)) then tj=0
if font="" then font=9
if open="1" then
open="_open"
else
open="_self"
end if
if w="" then w=100
if h="" then h=100
if x="" then x=1
if y="" then y=1
x=int(x)
y=int(y)
xy=x*y
if (not isNumeric(lm2)) then
lm2=0
end if

path=config("path")

sql = "select top "&xy&" * from news where ( pic like '%.jpg%' or pic like '%.JPG%' or pic like '%.gif%' or pic like '%.GIF%' ) and sh=1 "
if lm2<>"0" then sql=sql&" and (lm='"&lm2&"' or lm2='"&lm2&"' or lm3='"&lm2&"') "
if tj="1" then sql=sql&" and tj='推荐' "
sql=sql&" order by ontop desc , updat desc , id desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
%>
document.write("<div align=center>");
document.write("<table border=0 cellpadding=0 cellspacing=0 width=100% id=tableasdaDF1>");
<%
if rs.recordcount<>0 then
for yyyy=1 to y
%>
document.write("<tr>");
<%
if rs.eof then exit for
for xxxx=1 to x

id=rs("id")
title=trim(rs("title"))
pic=rs("pic")
pic=replace(pic,"border=","bo=")
pic=replace(pic,"""","")
Filename=rs("filename")
if filename="" then filename=0
if title="" then title=" "
if n<>0 then
ttt="<BR><font color="&rs("titlecolor")&">"&titleb(title,n)&"</font>"
end if
%>
document.write("<td align=center style='font-size:9pt;line-height:150%'><a href='/view.asp?nid=<%=id%>&lm=<%=lm2%>' target='<%=open%>' title='<%=title%>' ><img hspace=2 vspace=2 border=0 width=<%=w%> height=<%=h%> src='<%=pic%>'style='border: 1px solid #666666; padding: 4px; '><br><font style='font-size:9pt'><%=title%></font></a></td>");
<%
rs.movenext
if rs.eof then exit for
next
%>
document.write("</tr>");
<%
next
else
%>
document.write("暂无图片信息");
<%
end if
%>
document.write("</table>");
document.write("</div>");

<%
conn.close:set conn=nothing
%>
展开
 我来答
haoyue10
推荐于2016-09-10 · TA获得超过473个赞
知道答主
回答量:88
采纳率:100%
帮助的人:36万
展开全部
y=trim(request("y"))
w=trim(request("w"))
h=trim(request("h"))
n=trim(request("n"))
lm2=trim(request("lm2"))
tj=trim(request("tj"))
if lm2="" then lm2=trim(request("lm"))
if n="" then n=20
n=int(n)
open=trim(request("open"))
font=trim(request("font"))
if (not isNumeric(TJ)) then tj=0
if font="" then font=9
if open="1" then
open="_open"
else
open="_self"
end if
if w="" then w=100
if h="" then h=100
if x="" then x=1
if y="" then y=1
x=int(x)
y=int(y)
xy=x*y
if (not isNumeric(lm2)) then
lm2=0
end if

path=config("path")

sql = "select top "&xy&" * from news where ( pic like '%.jpg%' or pic like '%.JPG%' or pic like '%.gif%' or pic like '%.GIF%' ) and sh=1 "
if lm2<>"0" then sql=sql&" and (lm='"&lm2&"' or lm2='"&lm2&"' or lm3='"&lm2&"') "
if tj="1" then sql=sql&" and tj='推荐' "
sql=sql&" order by ontop desc , updat desc , id desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
%>
document.write("<div align=center>");
document.write("<table border=0 cellpadding=0 cellspacing=0 width=100% id=tableasdaDF1>");
document.write("<tr>");
<%
if not rs.eof then
numb=0
do while not rs.eof
numb=numb+1
id=rs("id")
title=trim(rs("title"))
pic=rs("pic")
pic=replace(pic,"border=","bo=")
pic=replace(pic,"""","")
Filename=rs("filename")
if filename="" then filename=0
if title="" then title=" "
if n<>0 then
ttt="<BR><font color="&rs("titlecolor")&">"&titleb(title,n)&"</font>"
end if
%>
document.write("<td align=center style='font-size:9pt;line-height:150%'><a href='/view.asp?nid=<%=id%>&lm=<%=lm2%>' target='<%=open%>' title='<%=title%>' ><img hspace=2 vspace=2 border=0 width=<%=w%> height=<%=h%> src='<%=pic%>'style='border: 1px solid #666666; padding: 4px; '><br><font style='font-size:9pt'><%=title%></font></a></td>");
<%

rs.movenext
if (numb mod x)=0 and numb<x*y then
%>
document.write("</tr><tr>");
<%
end if
if numb>=x*y then
exit do
%>
document.write("</tr>");
<%
end if
loop
else
%>
document.write("暂无图片信息");
<%
end if
%>
document.write("</table>");
document.write("</div>");

<%
conn.close:set conn=nothing
%>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
eiwinter
2010-10-06 · TA获得超过250个赞
知道小有建树答主
回答量:341
采纳率:0%
帮助的人:399万
展开全部
你这个程序改一下真累,试试我改的这个:

<%
x=trim(request("x"))
y=trim(request("y"))
w=trim(request("w"))
h=trim(request("h"))
n=trim(request("n"))
lm2=trim(request("lm2"))
tj=trim(request("tj"))
if lm2="" then lm2=trim(request("lm"))
if n="" then n=20
n=int(n)
open=trim(request("open"))
font=trim(request("font"))
if (not isNumeric(TJ)) then tj=0
if font="" then font=9
if open="1" then
open="_open"
else
open="_self"
end if
if w="" then w=100
if h="" then h=100
if x="" then x=1
if y="" then y=1
x=int(x)
y=int(y)
xy=x*y
if (not isNumeric(lm2)) then
lm2=0
end if

path=config("path")

sql = "select top "&xy&" * from news where ( pic like '%.jpg%' or pic like '%.JPG%' or pic like '%.gif%' or pic like '%.GIF%' ) and sh=1 "
if lm2<>"0" then sql=sql&" and (lm='"&lm2&"' or lm2='"&lm2&"' or lm3='"&lm2&"') "
if tj="1" then sql=sql&" and tj='推荐' "
sql=sql&" order by ontop desc , updat desc , id desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
%>
document.write("<div align=center>");
document.write("<table border=0 cellpadding=0 cellspacing=0 width=100% id=tableasdaDF1>");
document.write("<tr>");
<%
if not rs.eof then
numb=0
do while not rs.eof
numb=numb+1
id=rs("id")
title=trim(rs("title"))
pic=rs("pic")
pic=replace(pic,"border=","bo=")
pic=replace(pic,"""","")
Filename=rs("filename")
if filename="" then filename=0
if title="" then title=" "
if n<>0 then
ttt="<BR><font color="&rs("titlecolor")&">"&titleb(title,n)&"</font>"
end if
%>
document.write("<td align=center style='font-size:9pt;line-height:150%'><a href='/view.asp?nid=<%=id%>&lm=<%=lm2%>' target='<%=open%>' title='<%=title%>' ><img hspace=2 vspace=2 border=0 width=<%=w%> height=<%=h%> src='<%=pic%>'style='border: 1px solid #666666; padding: 4px; '><br><font style='font-size:9pt'><%=title%></font></a></td>");
<%

rs.movenext
if (numb mod x)=0 and numb<x*y then
%>
document.write("</tr><tr>");
<%
end if
if numb>=x*y then
exit do
%>
document.write("</tr>");
<%
end if
loop
else
%>
document.write("暂无图片信息");
<%
end if
%>
document.write("</table>");
document.write("</div>");

<%
conn.close:set conn=nothing
%>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
干好每一天
2010-10-03 · 超过78用户采纳过TA的回答
知道答主
回答量:209
采纳率:0%
帮助的人:188万
展开全部
for xxxx=1 to x
下面加这个
if xxxx mod 4 =0 then
rsponse.write "<br />"
else
......// 执行下面的语句
end if
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式