Simple HTML Q

Wespen

Member
Joined
Jan 13, 2003
Messages
10
Ok the code is


<td height="15" onMouseover="this.style.backgroundColor=#CC3333; " onMouseout="this.style.backgroundColor=#FFFFFF; "><div align="center" class="fontred" id = "1">
Text</div></td>


How can I change font color onMouseOver

I tried this.1.style.color = #FFFFFF; but nothing

Thanks
Igor
 
Assuming the "1" in "this.1.style..." is the div, Id use a name that starts with an alpha. Try replacing "1" with "a1" or something.

You can also use onMouseover and onMouseout on the div tag to change the foreground color. You could either change the style or the class since your div is already using one.

-ner
 
Something like this??
(I added href so DIV is out. I have to change the color of link.)
"l1" is ID of a tag.

<td height="15" class="borderleft" onMouseover="this.style.backgroundColor=#CC3333;
this.l1.style.class = class2; " onMouseout="this.style.backgroundColor=#FFFFFF; "><div align="center" >
<a href="some.htm" id = "l1" class="class1">text</a></div></td>

But this code wont work!

Igor
 
Ah, if its a hyperlinke (anchor tag) that you want, simply set the "hover" style of the anchor tag in the stylesheet. Heres a sampe:
Code:
<html>
<style>
A:link
{
    COLOR: #FF0000;
    TEXT-DECORATION: none
}
A:visited
{
    COLOR: #800000;
    TEXT-DECORATION: none
}
A:active
{
    COLOR: #0000FF;
    TEXT-DECORATION: none
}
A:hover
{
    COLOR: #FFFF00;
    TEXT-DECORATION: underline
}
</style>
<body>
<table width="100%">
	<tr>
		<td onMouseover="this.style.backgroundColor=#CC3333;" onMouseout="this.style.backgroundColor=#FFFFFF">
			<div align="center"><a href="some.htm">hyperlink test</a></div>
		</td>
	</tr>
</html>

You can also set the alignment on the TD if thats all youre using the DIV for.

-nerseus
 
The problem is that link and cell hover colors are the same

When you roll mouse over cell it becomes red, and you have to go a llitle more to go over link.

I want to change the link color when I roll over table cell.

Thanks
Igor
 
Back
Top