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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change bgcolor in TD with onMouseOver 2

Status
Not open for further replies.

imendi

Programmer
Oct 14, 2002
33
ES
Hello,

I am trying to change the bgcolor of a TD when the user moves the mouse over it.
So I have:
<TD onMouseOver=&quot;TDColor(this,'#808080');&quot;>

and the function

function TDColor(a,b) {
this=a;
a.bgcolor=b;
}

and it doesn´t work, what is wrong?

Thanks,

im
 
<table>
<tr>
<td id='element' style=&quot;width:200px;&quot; onmouseout=&quot;this.style.backgroundColor='#FFFFFF';&quot; onmouseover=&quot;this.style.backgroundColor='#666666';&quot;>xczczxc</td>
</tr>
</table>


This can allso be done using style sheets and setting the class of the element.
<td class='table3' id='element' style=&quot;width:200px;&quot; onmouseout=&quot;this.className='table3';&quot; onmouseover=&quot;this.className='table2';&quot;>xczczxc</td>
 
Hi
Try this amended function:
function TDColor(a,b) {
a.style.backgroundColor=b;
} Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top