css - 表格 css 的 .asp 循环

标签 css asp-classic

我对 .asp 一无所知,我们只是为界面设计外观,我需要为每个其他表格行设置样式,使其呈灰白色灰白色等...

zebra-style table? odd and even rows with different background-color?

这是代码。

<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%">&nbsp;</td></tr>
</thead> 
<tbody> 
<%
if isnull(floorcosts) then
    Response.Write("<tr><td colspan = '4'>&nbsp;</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>&nbsp;&nbsp;&nbsp;")
        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>&nbsp;&nbsp;&nbsp;")
   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

关于css - 表格 css 的 .asp 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6504462/

相关文章:

html - EL表达式不平衡jsf

html - asp classic 和 select 标签具有多个属性

javascript - 经典 ASP + JavaScript

javascript - Jquery 与 css 的悬停不同

css - 属性名称中前面的下划线针对的是什么浏览器和版本?

mysql - 将 LEFT JOIN 限制为最多一个结果

javascript - 如何在我的网站中嵌入来 self 的 youtube channel 的最新视频

html - 溢出导致的padding bottom : auto

css - 寻找 CSS 将不同列表项的子项放在一行中,而不在列表项上 float ?