Forum Moderators: open

Message Too Old, No Replies

using onmouseover with links

only works with no link in the table cell

         

Scootman78

11:04 pm on Mar 1, 2003 (gmt 0)

10+ Year Member



Hi guys,

I've looked through 100 different forum topics and
couldn't find one that actually mentions my problem. So here goes:

________________________________________
<table border="1"><tr>
<td onMouseover="bgColor='aqua'" onmouseout="bgColor='FFFFDE'"> &nbsp;&nbsp;&nbsp;&nbsp;<a href ="example.html" STYLE="TEXT-DECORATION: NONE">United States</a></td></tr></table>
________________________________________

I have the code above in my html page. Without the link being present, everything works as I want it to. The cell highlights light blue (aqua) when the mouse is over it, and it goes to a beige color when the mouse is not over it.

I need to have a link in the cell though, as in the code above. For some reason when the link is in the cell, the text is highlighted navy blue, the text forecolor is white, and the rest of the cell goes to aqua blue.

With the link present, I need the whole cell to highlight aqua blue and the text forecolor to stay black (just as mentioned in the paragraph right under the code).

Is there some extra code I can put into the code to get the results I need?

If what I'm looking for can't be done, is there another way to work around this without having to go to an imagemap?

Thanks for any help you can give me.

Birdman

12:05 am on Mar 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

You can do exactly what you want with CSS [w3.org] alone. No need for JavaScript. You will need your CSS [w3.org] stylesheet in the head of your document.

<style type="text/css">
a{display: block; background-color; #ffffde;}
a:visited{display: block; background-color; #ffffde;}
a:hover{display: block; background-color; aqua;}
</style>

See W3Schools [w3schools.com] for a good CSS [w3.org] reference.

Scootman78

12:25 am on Mar 2, 2003 (gmt 0)

10+ Year Member



Thanks for the info. I actually read about doing that earlier and every time I would try putting it into my HTML, it wouldn't do anything for me.

Then I realized I had linked to an external CSS style sheet already, and my code was recognizing only the external sheet.

I have Dreamweaver MX, so all I did was mess with the CSS code there for a: hover.

Thanks again. Problem solved.