Click to See Complete Forum and Search --> : Mouseover and text color


andersoni
09-05-2003, 12:50 AM
I am trying to change the text color of a cell in a table when I mouse over the cell. Here is the code for the mouse over,

onmouseover="this.style.color='#FFFFFF';this.style.cursor='pointer'"

The pointer changes fine but the text color doesn't.

Any suggestions?

Ian

Khalid Ali
09-05-2003, 01:07 AM
sounds like you have more elements in the cell e.g anchor tags and stuff,if so you might need to set colors for those elements explicitly.

andersoni
09-05-2003, 01:34 AM
Here is an example of the code,

<table border="0" cellpadding="7" cellspacing="0" style="border-collapse: collapse; font-family:Arial; font-size:10pt; color:<%=Shopclr%>; font-weight:bold" width="120" id="AutoNumber3" height="40">
<tr>
<td id="c1" bgcolor="blue" onmouseover="this.style.color='#FFFFFF';this.style.cursor='pointer'" onmouseout="this.style.color='';this.style.cursor=''" width="120" height="40">
<font color="#000000">
<p align="right">test
</font>
</td>
</tr>
</table>

Fang
09-05-2003, 02:28 AM
Give the onmouseout color a value not "empty"

andersoni
09-06-2003, 12:15 PM
What I have found is that if I remove the <font> tag all works fine. I would like the option of setting the initial font color and change it with a mouseover.

Suggestions?

Ian

Fang
09-06-2003, 12:52 PM
The font tag overreides any style you use previously

<style type="text/css">
<!--
.over {
color:#FFFFFF;
background-color:Blue;
cursor:pointer;
}
.out {
color:#FF0000;
background-color:Cyan;
cursor:default;
}
-->
</style>
</head>
<body>
<table border="0" cellpadding="7" cellspacing="0" style="border-collapse: collapse; font-family:Arial; font-size:10pt; font-weight:bold" width="120" id="AutoNumber3" height="40">
<tr>
<td id="c1" class="out" onmouseover="this.className='over';" onmouseout="this.className='out';" width="120" height="40">
<p align="right">test
</td>
</tr>
</table>
</body>

andersoni
09-06-2003, 02:13 PM
Works like a dream! One quick question. I have done very little with CSS and even less research into it. Does Nerscape do CSS?

Thanks

Ian:)

Fang
09-06-2003, 03:01 PM
Yes