Formatting background with cycle

I've got a <tr> with onmouseout="this.style.background='<%= cycle(odd-row, 'even-row')%>';"

But that doesn't seem to work. onmouseover changes the bg to white, and I need to get the color back to its original color onmouseout.

The problem is the color is different for alternating rows.

Any help is appreciated!

The result of your cycle will be a string, so the normal way to use this would be to assign the string to a class name, and then for each class, you define the background style you need in your stylesheet.

<tr class="<%= cycle("even", "odd") -%>">

see http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001928&name=cycle.

If you want to build the whole style fro the cycle, it would need to be like this

style="background-color: <%= cycle("#fff", "#ccc")

hth Tonypm