change background of table onmouseover

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
dheeraj
Forum Commoner
Posts: 40
Joined: Fri Feb 06, 2009 11:54 am

change background of table onmouseover

Post by dheeraj »

hello i guys i know hw to change a color of a cell on any event, bt not getting the way to chage table bgcolor on any event so plz anyone help me ...


Thanks..
Dheeraj
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: change background of table onmouseover

Post by Reviresco »

Code: Select all

<table id="the_table">
 <tr>
  <td>
  Test<br />test <br />
  test test test test test
  </td>
 </tr>
</table>
<p>
<a href="/" onmouseover="document.getElementById('the_table').style.backgroundColor = 'orange';">Mouse over this</a>
</p>
User avatar
juma929
Forum Commoner
Posts: 72
Joined: Wed Jun 17, 2009 9:41 am

Re: change background of table onmouseover

Post by juma929 »

Hello,

You can do the example above or research changing the className which relates to a class in your stylesheet making your page a little easier to maintain in future.

Thanks.
Post Reply