PDA

View Full Version : Need help changing color of link when onMouseOver


jroberts
09-30-2002, 05:03 AM
Can someone help me with a function that will change the color of a link onMouseOver. I am new at this, and have tried looking at source, but most of pages with this functionality are to complicated for me to understand.

Thanks in advance.:(

glenngv
09-30-2002, 06:20 AM
put this inside <head> tag:

<style>
a:visited{color:blue}
a:link{color:blue}
a:hover{color:red}
</style>

Alekz
09-30-2002, 08:09 AM
Hi,
glenngv's answer will change the style of all Your links on this page. Often this is right what is needed. But it recently happened to me to need more than a style for links on the same page (I just needed different highlight colors)...
So the solution was:
<style>
.lnk {text-decoration: none}
.lnk:link {color: red}
.lnk:visited {color: red}
.lnk:hover {color: blue}

.altlnk {text-decoration: none}
.altlnk:link {color: bule}
.altlnk:visited {color: blue}
.altlnk:hover {color: red}
</style>

And then
<a class="lnk">Lnk</a>
<a class="altlnk">Lnk</a>

Alex

jroberts
09-30-2002, 02:08 PM
Thanks to the both of you! Both examples will be useful.
Thanks again:thumbsup: