Not sure how efficient this is, but this is what I used to have alternating colours (you do need to have them in a table). This is using the code supplied by bigTex:

HTML Code:
<script type="text/javascript"
...