Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4571
  • Last Modified:

mouseover <td> text color change

I would like to know, how to make the text color change when mouseover the <td>, not the text ??

For background color change, I had wrote this and it works:

<td height="20" class="Menu" onMouseOver="this.bgColor='#66cccc';" onMouseOut="this.bgColor='#9999ff'">Menu</td>

is set the font color change also simple like this ??

Thx a lot,
sL

0
sLso
Asked:
sLso
1 Solution
 
paStiSSetCommented:
using this, i have tested and it works correctly:

<td height="20" class="Menu" onMouseOver="this.bgColor='#66cccc'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#9999ff'; this.style.color='#0000FF'">Menu</td>
0
 
seanpowellCommented:
Just in case you want to use this in multiple places, you can use a stylesheet...

<html>
<head>
<style>
<!--
.over { background-color:#66cccc; color:#FF0000; }
.out  { background-color:#9999ff; color:#000000; }
-->
</style>
<script language="JavaScript">
<!--
   function chgcell(EL,color)
   {
      var cell=EL;
      cell.className=color;
   }
//-->
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20" class="Menu" onMouseOver="chgcell(this,'over')" onMouseOut="chgcell(this,'out')">Menu</td>
  </tr>
</table>
</body>
</html>
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now