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

mod 问题~~ 请高手进来看看~~ 急~~~~~~~~
我想输出新闻列表
格式如下:   1       2
                    3       4
                    5       6
这样的~现在的问题是输出奇数时候     就串行~     本人怀疑是下面的TAble没有输出的问题~   不知道怎么解决~请大家帮助

<%
set   rs=openrs( "select   *   from   pic   where   classid=132 ")
for   j=1   to   6
    if   rs.eof   then   exit   for          
  if   j   mod   2=1   then
%>

<table   width= "173 "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
  <tr>
        <td   align= "center "   width= "86 "> <a   href= "# "   class= "zi_hei "> <%=rs( "picname ")%> </a> </td>
        <td   width= "1 "   bgcolor= "#FF9900 "   align= "left "> </td>
<%
else
%>

        <td   align= "center "   width= "86 "> <a   href= "# "   class= "zi_hei "> <%=rs( "picname ")%> </a> </td>
  </tr>
</table>
<%
end   if            
rs.movenext
next
closers(rs)
%>

------解决方案--------------------
<table width= "173 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<%
set rs=openrs( "select * from pic where classid=132 ")
n = rs.RecordCount
for j=1 to n
if j mod 2 = 1 then response.write " <tr> "
%>
<td align= "center " width= "86 "> <a href= "# " class= "zi_hei "> <%=rs( "picname ")%> </a> </td>
<%
if j mod 2 = 1 then
%>
<td width= "1 " bgcolor= "#FF9900 " align= "left "> </td>
<%
end if
if (j = n) && (j mod 2 = 1) then response.write " <td> </td> "
if j mod 2 = 0 then response.write " </tr> "
rs.movenext
next
closers(rs)
%>
</table>