要让表格底色间隔显示十行,并且每行显示4条信息!
这是我的代码,可是我只显示十行,但是现在限制不住底色显示,并且我实现不了每行显示4条信息!求高手帮忙!谢谢!
<table width="226" border="0" cellpadding="0" cellspacing="0" class="x04">
<%
set rs=server.CreateObject("adodb.recordset")
sql="select top 40 id_xl,name_xl from xl_qyjfc_gsl_bjh where type_xl=2 order by id_xl desc"
rs.open sql,conn,1,3
If Not rs.eof or not rs.bof Then
dim j
j=0
Do While Not rs.eof
%>
<tr>
<td height="25" <%if j<10 and(j mod 2)=1 then response.write "bgcolor=#f1f1f1"%>><div align="center" class="STYLE6"><a href='qyjml_view.asp?hid=<%=rs("id_xl")%>' class="link"><%=left(rs("name_xl"),3)%></a></div></td>
<%
rs.movenext
j=j+1
Loop
else
%>
<font> 暂无信息</font>
<%
End If
rs.close
%>
</tr>
</table>
------解决方案--------------------VB code
Rs.open sql,Conn,1,1
if Not Rs.eof then
Dim i,j
i = 1 : j = 1
str = str &"<tr>"
do while not rs.eof
if j mod 2 = 0 Then YourClass = "classRed" : Else : YourClass = "classBlue"
str = str & "<td class='"& YourClass &"'>AAA</td>"
if (i mod 4)=0 Then Str = str & "</tr><tr>" : j = j + 1
i = i + 1
rs.movenext
loop
str = str &"</tr>"
End if
Rs.close
------解决方案--------------------
你这个是需要10行4列的结构,那么一定要双循环了
而且要判断整除4的就换行并且换色