我对.asp一无所知。我们只是为界面设置皮肤,我需要为每一个表格行设置样式,使其灰白色灰白色......等等。
斑马风格的桌子?奇数和偶数行 用不同的背景色?
这是代码。
<table id="table1" class="tablesorter">
<thead>
<tr align = "center" ><td><h4>Description</h4></td><td><h4>Comments</h4></td><td><h4>Annual Cost</h4></td><td width = "15%"> </td></tr>
</thead>
<tbody>
<%
if isnull(floorcosts) then
Response.Write("<tr><td colspan = '4'> </td></tr>")
Response.Write("<tr><td colspan = '4' align = 'center' style='font-size:16pt;font-style:bold;'>No Floor Costs Defined</td></tr>")
else
dim i
for i = 0 to ubound(floorcosts,1)
Response.Write("<tr align = 'center' id = 'r" & i & "'><td>" & floorcosts(i,0) & "</td><td>" & floorcosts(i,2) & "</td><td align='right'>" & FormatCurrency(floorcosts(i,1)) & "</td>")
Response.Write("<td><a href = 'floorcosts.asp?t=" & i & "'><img src = 'images/edit.png' height = '25' width = '25' alt = 'Edit' title = 'Edit Cost' /></a> ")
Response.Write("<a href = 'javascript:delrec(" & i & ")'><img src = 'images/delete.png' height = '25' width = '25' alt = 'Delete' title = 'Delete Cost'/></a></td></tr>")
next
end if
%>
</tbody>
</table>
我有一种风格,我想放在其他每一行。
<tr class="grey_row">
我如何在整个.asp循环中实现这一点。
有人可以帮忙。
答案 0 :(得分:2)
我唯一能看到你能做到的地方是:
Response.Write("<tr align = 'center' id = 'r" & i & "'><td>" &
您可以尝试用
替换它Response.Write("<tr class='grey_row' align = 'center' id = 'r" & i & "'><td>" &
斑马纹代码:
dim cl
for i = 0 to ubound(floorcosts,1)
if i mod 2 = 0 then
cl = "grey_row"
else
cl = "white_row"
end if
Response.Write("<tr class='"&cl&"' id = 'r" & i & "'><td>" & floorcosts(i,0) & "</td><td>" & floorcosts(i,2) & "</td><td align='right'>" & FormatCurrency(floorcosts(i,1)) & "</td>")
Response.Write("<td><a href = 'floorcosts.asp?t=" & i & "'><img src = 'images/edit.png' height = '25' width = '25' alt = 'Edit' title = 'Edit Cost' /></a> ")
Response.Write("<a href = 'javascript:delrec(" & i & ")'><img src = 'images/delete.png' height = '25' width = '25' alt = 'Delete' title = 'Delete Cost'/></a></td></tr>")
next