View Full Version : Colour changes in a table
Dingbat
10-05-2002, 06:32 PM
Hi Guys,
I have a desire to know how to change the background colour of rows in a table with a mouse over event and when a link in a row is clicked the background to change to a 3rd colour?:rolleyes:
x_goose_x
10-05-2002, 06:56 PM
<table border="1" width="100%">
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr onmouseover="if (!this.getAttribute('tmp')) {this.style.backgroundColor='red';};" onmouseout="if (!this.getAttribute('tmp')) {this.style.backgroundColor='';};" onclick="if (event.srcElement.tagName.toLowerCase()=='a') {this.style.backgroundColor='blue'; this.setAttribute('tmp',true);};">
<td width="50%"><a href="javascript:;">site</a></td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
</table>
Dingbat
10-05-2002, 07:13 PM
x_goose_x thanks for your assistance. I recon that I ca now modify your script to meet my needs.
Thanks again:thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.