.asp loop for table css
I know nothing about .asp we are just skinning an interface and i need to style every other table row so its grey white grey white etc...
zebra-style table? odd and even rows with different background-color?
Here is the code.
<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开发者_JAVA百科 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>
i have got a style the i want to drop on every other row.
<tr class="grey_row">
how can i implement this throughout the .asp loop.
Can someone please help.
the only place i see where you can do this is:
Response.Write("<tr align = 'center' id = 'r" & i & "'><td>" &
you may try to replace it with
Response.Write("<tr class='grey_row' align = 'center' id = 'r" & i & "'><td>" &
zebra style code:
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
精彩评论