You can do this my using $('mydiv').addClassName('something') on the
mouseover, and ('mydiv').removeClassName('something') on the mouseout.
Then you just make a few CSS entries for the alternate styles.
When I do this I typically make the CSS something like:
.row0 {
background-color:#c0c0c0;
}
.row1 {
background-color:#e0e0e0;
}
.row0highlight{
font-weight:bold;
}
.row1highlight{
font-weight:bold;
so you'd do :
onmouseover="$('mydiv').addClassName('row0highlight')"
onmouseoout="$('mydiv').removeClassName('row0highlight')"
}
On Jul 5, 1:58 pm, szimek <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i've got a problem with highlighting table rows that change their
> color when user hovers mouse over them - when user clicks some buttons
> in the row, it is highlighted and then it goes back to the color
> specified in tr:hover, not to it's original color. The additional
> problem with it is that rows are colored alternatively - I've got 2
> separate classes for even/odd rows.
>
> While I understand why it happens, is there some easy way to avoid/fix
> it?
>
> Is there a way to get specific css property (in this case background
> color) from specified css class? Then I could check if the highlighted
> row is even or odd, get the background color value for respective css
> class and set it as a final color value for the highlight effect. I
> could hardcode color values into javascript, but if I change css
> style, I'd have to modify my javascript code as well.
>
> Or maybe it's possible to find an element that has the same class as
> the highlighted element, but does not have hover effect turned on
> currenty? Is it possible?
>
> Thank you in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---