View Full Version : javascript Tr

06-21-2009, 08:18 PM
Hi I am very new to javascritp and just playing around with a few things. I am looking for a way to change the background style of a table row element

I have a table that is dynamically created using PHP at the end of each row inside a <td> in the table one per row there is an image. When this image is clicked I would like the background colour of the entire row that image is on to change to #CCC

also if another image is clicked in the table I want to revert the background colour of the previous row back to blank and select the new row.

A sort of highlight per row that you select. only being able to select one row at a time.

thanks in advance for any help.

if it is not too much more code though I have a feeling it is some <td>'s in the row I want selected might be empty if this is the case I wouldn't like the background of that td to change, or change the <tr> background and change empty <td>'s to the table backgrounds colour.

But as I said this isn't really that important as I imagine it is more than a couple of lines of code extra :D