...

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%">&nbsp;</td>
<td width="50%">&nbsp;</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%">&nbsp;</td>
</tr>
<tr>
<td width="50%">&nbsp;</td>
<td width="50%">&nbsp;</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:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum