PDA

View Full Version : Highlight Table Cells Script



echristo66
09-23-2005, 10:42 PM
Hello I am using the script from:

http://www.dynamicdrive.com/dynamicindex11/highlighttable.htm

My goal is to have an entire table row change to a light yellow with the onMouseover command, as in the script above. It works great, except for the fact every other table row in my table is a light grey. The rows which are "white" work. The "greys" don't.

When you specify it to highlight "TD" instead of "TR" the table cell color does not matter, white or grey, it will change any indvidual cell you rollover to "light yellow". I really want it to work for the "TR" so I can highlight entire rows.

I have placed my Javascript in a file named tables.js. It is the same code found at the link above, except I am using the "TR".

here is my page: http://www.fantasy.altcool.com/2005/standings.html

Any help is much appreciated!

jscheuer1
09-24-2005, 05:27 AM
The problem is that for the gray rows, you've applied a background color to each cell. Because of this, the background color of the row cannot show through. Change this type of markup (used for each gray row):

<tr onMouseover="changeto(event, '#FFFFCC')" onMouseout="changeback(event, '#F1F2ED')">
<td bgcolor="#F1F2ED">&nbsp;2</td>
<td bgcolor="#F1F2ED">Alaskan Thunder-Phuk</td>
<td bgcolor="#F1F2ED">0-0-0</td>
<td bgcolor="#F1F2ED">0.000</td>
<td bgcolor="#F1F2ED">&nbsp;</td>
<td bgcolor="#F1F2ED">&nbsp;</td>
</tr>to this type:

<tr bgcolor="#F1F2ED" onMouseover="changeto(event, '#FFFFCC')" onMouseout="changeback(event, '#F1F2ED')">
<td>&nbsp;2</td>
<td>Alaskan Thunder-Phuk</td>
<td>0-0-0</td>
<td>0.000</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>and all should work as you want it to.

echristo66
09-24-2005, 09:58 PM
Thanks! I swore I tried that already...but I guess I did not? Thanks for the quick response.