View Single Post
Old Mar 2nd, 2008, 9:33 AM   #3
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3 kruptof is on a distinguished road
Re: Higlight row using DOM

Quote:
Originally Posted by Sane View Post
I solved it by wrapping the <tr></tr> in a tbody, and then manipulating the tbody's class.
Just tried the wrapping and it still behaves the same. I think this is happening because the mouseover event is not being propagated to the cells ancestors. I found a work around which is to get the parent of the cell an set its classname:
elm.parentNode.className = "highlight"

Quote:
Originally Posted by Sane View Post
Oh, and your javascript can be substituted with something stabler, quicker, and more compatible: CSS. Unless you need to do more than alter the hover colour.
The reason I went with JS over CSS is because I find it some browsers don't all support the hover pseudo class for all elements especially IE.


Quote:
Originally Posted by Sane View Post
Also, enumerating each tr tag in your javascript is odd. Why not directly reference the tag you're looking for?
Please explain further, do you mean give each tr a unique id? If so wouldn't this be more code than now.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote