I’ve spend a lot of time with PrototypeJS last few days, and this is going to be my first post related to prototype. So let’s see how to stripe the table using prototype, I think you will be surprised how easy it is.
HTML for our table will look like
We will also need some CSS to change the background of the even rows and to highlight the row mouse is over
And now all we need is as simple as
One thing to notice is that tr:hover selector won’t work in IE 6. If you care about IE6, solution could be to observe row for mouseover event and to add hover class dynamically.
You should add
and change table.zebra tr:hover to
Looks like this won’t be a last post devoted to Prototype 😉