Posted By

f0vela on 03/13/08


Tagged

div table ASP row colors alternate


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

nelda751
ckayra
asifrizvigmailcom
britevents


Alternate row colors


 / Published in: ASP
 

  1. '************************************************
  2. '
  3. ' To use it put the code like this on your loop:
  4. '
  5. ' <%counter = counter + 1%>
  6. ' <tr bgcolor="<%=Acolor(counter,"#a0a0a0","#e0e0e0")%>">
  7. ' <td>Data</td>
  8. ' </tr>
  9. '
  10. ' n is the external counter
  11. ' col is the first color in hex format
  12. ' col2 is the second color in hex format, you can leave it empty
  13. '************************************************
  14.  
  15. function Acolor(n,col,col2)
  16.  
  17. num = 0
  18. num = n mod 2
  19.  
  20. if col2 = "" then col2 = "#ffffff"
  21.  
  22. if num = 0 then
  23. Acolor = col
  24. else
  25. Acolor = col2
  26. end if
  27.  
  28. end function

Report this snippet  

You need to login to post a comment.