Matt Pinkston
asked on
onmouseover cell color
I am trying to find out why my cell color will not change?
I put in the following:
<a target="I1" href="inc_opportunities_op en_intel.a spx"><td class="style7" onMouseover="this.bgColor= 'lightblue ';" onMouseout="this.bgColor=' ';" style="width: 75px">open</td></a>
I put in the following:
<a target="I1" href="inc_opportunities_op
ASKER
No error but no change in colors
<a target="I1" href="inc_opportunities_op en_intel.a spx"><td class="style7" onMouseover="this.bgColor= 'lightblue '" onMouseout="this.bgColor=' white'" style="width: 75px">open</td></a>
<a target="I1" href="inc_opportunities_op
I think you need to use hex values. Tested this and it works:
<TR onMouseover="this.bgColor= '#99AACC'" onMouseout="this.bgColor=' #FFFFFF'">
<TR onMouseover="this.bgColor=
ASKER
no change
<a target="I1" href="inc_opportunities_op en_intel.a spx"><td class="style7" onMouseover="this.bgColor= '#99AACC'" onMouseout="this.bgColor=' #FFFFFF'" style="width: 75px">open</td></a>
<a target="I1" href="inc_opportunities_op
I see a couple of problems.
Wrapping a <td> in an <a> element is not a good idea. Rather put your <a> inside the <td> make it a block element and the height and width you want and then use CSS :hover to change the cell.
Wrapping a <td> in an <a> element is not a good idea. Rather put your <a> inside the <td> make it a block element and the height and width you want and then use CSS :hover to change the cell.
a {
width: 75px;
}
a:hover {
background: lightblue;
}
HTML<table>
<tr>
<td>
<a href="">one</a>
</td>
...
</tr>
...
++ on Julian's solution. It's the way it's been done for the past 7 years or so.
But, if you're stuck on archaic systems behind corporate rules, you might need to do it old style.
If you can tell us the browser you're using to test your code, we could be of more assistance.
Dan
But, if you're stuck on archaic systems behind corporate rules, you might need to do it old style.
If you can tell us the browser you're using to test your code, we could be of more assistance.
Dan
ASKER
Browser is IE11
On the second option you have to mouse over the word to click it, I want users to be able to click the box instead which is why we went the other route.
On the second option you have to mouse over the word to click it, I want users to be able to click the box instead which is why we went the other route.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your original code works fine. The only way to break it is if the TD is not part of a table...
http://jsfiddle.net/GaryC123/5L5Pw/
Tho everything Julian says still holds true.
http://jsfiddle.net/GaryC123/5L5Pw/
Tho everything Julian says still holds true.
What's the doctype? bgcolor is not supported in HTML5 although I'd be surprised if IE11 didn't support it anyway.
ASKER
excellent thanks
Open in new window
HTH,
Dan