日期:2014-05-17  浏览次数:21170 次

表格显示固定数量图片的问题
我想在表格里显示图片,可是我这个会把所有的图片都在一行里显示,我想每行显示5个图片,一到五个自动换行,也就是一行五列,请问怎么实现?下面是我现在的代码,谢谢了
<%set   rs=server.createobject( "adodb.recordset ")
rs.open   "select   *   from   huajia   order   by   id   desc ",conn,1,1
if   rs.eof   and   rs.bof   then
    response.write   "现在还没有填加内容! "
    else
    do   while   not   rs.eof
%>
                  <table> <tr> <td>                  
<a   href= <%response.write   server.URLEncode( "xq01.asp ")%> ?huajiam= <%=rs( "huajiam ")%>   target= "_blank "   class= "gray ">  
                <img   src= " <%=rs( "huajiam ")%> "   width= "100 "   height= "100 ">                                     </a>   </td> </tr> </table>
                                   

<%rs.movenext
    loop
    end   if
    rs.close
    set   rs=nothing%>

------解决方案--------------------
<table>
<tr>
<td width= "100% " height= "25 ">
<table border= "0 " cellpadding= "0 " width= "100% " align= "center ">
<tr align= "center "> <%
set rs=server.createobject( "adodb.recordset ")
rs.open "select * from huajia order by id desc ",conn,1,1
do while not (rs.eof or err)
%>

<td>
<a href= <%response.write server.URLEncode( "xq01.asp ")%> ?huajiam= <%=rs( "huajiam ")%> target= "_blank " class= "gray ">
<img src= " <%=rs( "huajiam ")%> " width= "100 " height= "100 "> </a> </td> <%ka=ka+1
if ka=5 then
ka=0 %> </tr>
<%end if
rs.MoveNext
Loop
%>
</table> </td>
</tr> </table>


再试试这个!!!
上面哪个好象有问题!!!