Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting table row on hovering on one cell

Status
Not open for further replies.

cmhunt

Programmer
Apr 17, 2001
119
GB
Hi
I have a four column table. I have hyperlinks in the first column and data in the other three. I have it at the moment so the background of the hyperlink changes colour on hovering over it using CSS. Is it possible to change the colour of the whole table row on hovering on just the hyperlink in the first column?

Thanks

Chris
 
Hi Chris,

Yes it is possible , but I know only the IE solution:

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;
function highlight(cell)
{
cell.bgColor = '#ffff00';
}

function normal(cell)
{
cell.bgColor = '';
}
</script>

<table border=1 cellpadding=0 cellspacing=0 width=500>
<tr id=&quot;rowid1&quot; name=&quot;rowid1&quot;>
<td onmouseover=&quot;highlight(rowid1)&quot; onmouseout=&quot;normal(rowid1)&quot; width=200>
<a href=yourpage1.htm>linkname1</a>
</td>
<td width=200>
data row 1
</td>
<td width=100>
data row 1
</td>
</tr>
<tr id=&quot;rowid2&quot; name=&quot;rowid2&quot;>
<td onmouseover=&quot;highlight(rowid2)&quot; onmouseout=&quot;normal(rowid2)&quot; width=200>
<a href=yourpage2.htm>linkname2</a>
</td>
<td width=200>
data row 2
</td>
<td width=100>
data row 2
</td>
</tr>
</table>

Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Hi Starway,

That site only works in IE5.5 | NN 6.1 (or higher)

My solutions works (only in IE) But it works in IE4+

Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Don't know about IE4 - I don't have it, but meyerweb.com solution works in IE5.0, N6/Mozilla and Opera 5 and 6.

For me it's much better that something working ony in IE, even if 4th version.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top