Neil Rossi wrote on 08 aug 2003 in
comp.infosystems.
www.authoring.stylesheets: Quote:
Is there a way using CSS, without using client-side or server-side
scripting, to make list backgrounds alternate color with each
successive item in a dropdown list? Is there some other, better way
of displaying long dropdown lists so that the list items are visually
separated? TIA. |
Without having to give all the <tr>'s an alternating classname,
javascript [yes, you specified "no script"] does such a nice job:
<table id="mytable" ....
<script>
i=0;
x=mytable.firstChild.childNodes
while(i< x.length) {
if (i % 2)
x(i).style.backgroundColor="#ccc"
else
x(i).style.backgroundColor="#aaa"
i++
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)