我对.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循环中实现这一点。
有人可以帮忙吗?
最佳答案
我看到的唯一可以执行此操作的地方是:
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