求高手把这个ASP列显示图片代码改为横向输出图片 比如5行3列
<%dimrsdimsqlmsg_per_page=5setrs=server.createobject("adodb.recordset")fenlei=Request...
<%
dim rs
dim sql
msg_per_page = 5 set rs = server.createobject("adodb.recordset")
fenlei=Request.QueryString("f")
sql ="select * from [work] order by id desc"
rs.cursorlocation = 3 rs.pagesize = msg_per_page
rs.open sql,conn,0,1
if err.number<>0 then response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then totalrec = RS.RecordCount if rs.recordcount mod msg_per_page = 0 then n = rs.recordcount\msg_per_page else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page")
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage rowcount = rs.pagesize
dim i
dim k
%>
<%
rowcount = 1
do while not rs.eof and rowcount <=20%>
div align="center"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></div>
<%
rowcount=rowcount-1
rs.MoveNext
loop
end if
end if
rs.close
set rs=nothing
%> 展开
dim rs
dim sql
msg_per_page = 5 set rs = server.createobject("adodb.recordset")
fenlei=Request.QueryString("f")
sql ="select * from [work] order by id desc"
rs.cursorlocation = 3 rs.pagesize = msg_per_page
rs.open sql,conn,0,1
if err.number<>0 then response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then totalrec = RS.RecordCount if rs.recordcount mod msg_per_page = 0 then n = rs.recordcount\msg_per_page else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page")
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage rowcount = rs.pagesize
dim i
dim k
%>
<%
rowcount = 1
do while not rs.eof and rowcount <=20%>
div align="center"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></div>
<%
rowcount=rowcount-1
rs.MoveNext
loop
end if
end if
rs.close
set rs=nothing
%> 展开
3个回答
展开全部
最简单的办法是自动在浏览器上排列,排满一行再排第二行,方法是把<div align="center">和</div>修改为<table align=left><tr><td>和</table>
(如果看懂上面的了,不用看下面的详细)也就是把:
<div align="center"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></div>
修改为:
<table align=left><tr><td><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a><//td></tr></table>
(如果看懂上面的了,不用看下面的详细)也就是把:
<div align="center"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></div>
修改为:
<table align=left><tr><td><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a><//td></tr></table>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
给你几个思路,
1,在rs记录集循环之前加一个计数器,然后每次循环判断计数器的mod你想要换行的个数 ,如果为0就说明已经输出完5个,再输出"</tr><tr>"就换行了,伪码如下:
i=1
while not rs.eof
if i mod 5 =0 then response.write "</tr><tr>" '换行
..................其他操作。。。。
rs.movenext
i = i +1
wend
1,在rs记录集循环之前加一个计数器,然后每次循环判断计数器的mod你想要换行的个数 ,如果为0就说明已经输出完5个,再输出"</tr><tr>"就换行了,伪码如下:
i=1
while not rs.eof
if i mod 5 =0 then response.write "</tr><tr>" '换行
..................其他操作。。。。
rs.movenext
i = i +1
wend
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你拿下面这个测下 每排5个的 有问题再补充
<%
dim rs
dim sql
msg_per_page = 5 set rs = server.createobject("adodb.recordset")
fenlei=Request.QueryString("f")
sql ="select * from [work] order by id desc"
rs.cursorlocation = 3 rs.pagesize = msg_per_page
rs.open sql,conn,0,1
if err.number<>0 then response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then totalrec = RS.RecordCount if rs.recordcount mod msg_per_page = 0 then n = rs.recordcount\msg_per_page else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page")
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage rowcount = rs.pagesize
dim i
dim k
%>
<div style="text-align:center;width:780px;">
<ul style="padding:0;margin:0;list-style-type: none;">
<%
rowcount = 1
do while not rs.eof and rowcount <=20%>
<li style="padding:0;margin:0;float:left;width:150px;"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></li>
<%
rowcount=rowcount-1
rs.MoveNext
loop
end if
end if
rs.close
set rs=nothing
%>
</ul>
</div>
<%
dim rs
dim sql
msg_per_page = 5 set rs = server.createobject("adodb.recordset")
fenlei=Request.QueryString("f")
sql ="select * from [work] order by id desc"
rs.cursorlocation = 3 rs.pagesize = msg_per_page
rs.open sql,conn,0,1
if err.number<>0 then response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then totalrec = RS.RecordCount if rs.recordcount mod msg_per_page = 0 then n = rs.recordcount\msg_per_page else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page")
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage rowcount = rs.pagesize
dim i
dim k
%>
<div style="text-align:center;width:780px;">
<ul style="padding:0;margin:0;list-style-type: none;">
<%
rowcount = 1
do while not rs.eof and rowcount <=20%>
<li style="padding:0;margin:0;float:left;width:150px;"><font color="#FFFFFF"><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><img src=<%=rs("tubiao")%> class=xndyk width="128" height="80" border="0" title="<%=rs("names")%>"></a><br /><a href="pt.asp?id=<%=rs("id")%>" target="_blank"><font color="#000000"><%=rs("names")%></font></a></li>
<%
rowcount=rowcount-1
rs.MoveNext
loop
end if
end if
rs.close
set rs=nothing
%>
</ul>
</div>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询