开发者

.asp loop for table css

开发者 https://www.devze.com 2023-03-16 07:51 出处:网络
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...

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%">&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开发者_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>&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>

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>&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
0

精彩评论

暂无评论...
验证码 换一张
取 消