Topics:
» ASP
» HTML
» Stylesheets
» JavaScript
» PHP
» Flash
» More...

Site:
» Forum
» About

Text Rollovers

Text rollovers arn't brilliant in java because they don't change the color of the underline, but they still look good. Take a look at this example:

Microsoft

Now heres the source code for it:

<A HREF="http://www.microsoft.com/">
<FONT COLOR="#0000ff" onMouseOver="this.style.color = '#cc0000'" onMouseOut="this.style.color = '#0000ff'">Microsoft</FONT></A>

The two tags are onMouseOver and onMouseOut. All these do is change the color of the link when the mouse moves over the link, and change it back when the mouse moves off it.

Another problem with this is that it is only supported by Internet Explorer 4.0 and above, and I'm not sure about Netscape. Lets look at the java reference to it, to set the color to balck:

element.style.color = 'black';

As you can see it uses the elements style to change the color of the link. This gives you room to modify if. After all - who would want to link to Microsoft. Another good thing about using java script is that you can have different colored links and rollovers for each link, unlike Cascading Style Sheets which set a color for the whole page.