![]() |
Higlight row using DOM
I am trying to highlight a row in table when the user mouse overs the row. I am trying to do this by changing the className of the row to a CSS selector class which will change the background color. But instead of the whole row highlighting i am getting only cell in the row highling which is the one the mouse is over.
Below is the code for the page, had to put the style and scripts on the same page as the markup for the example and also i know this won't work across browsers because it's just an example: :
<html> |
Re: Higlight row using DOM
I remember trying to manipulate the styles of individual rows in tables, and I was running into similar problems.
I solved it by wrapping the <tr></tr> in a tbody, and then manipulating the tbody's class.:
<tbody class="mail"><tr>Hope that helps. Also, enumerating each tr tag in your javascript is odd. Why not directly reference the tag you're looking for? And of course, you're going to need to update that code to look for the mail tbody, instead of the mail tr. 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. |
Re: Higlight row using DOM
Quote:
elm.parentNode.className = "highlight" Quote:
Quote:
|
Re: Higlight row using DOM
Quote:
Quote:
|
| All times are GMT -5. The time now is 1:12 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC