Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anchors
Message
From
20/02/2003 07:26:14
 
 
To
20/02/2003 02:50:45
General information
Forum:
Internet
Category:
Javascript
Title:
Miscellaneous
Thread ID:
00755363
Message ID:
00755434
Views:
8
>How to change the color of a link by clicking on it using javascript functions.Are there any specific objects or properties.Please give an example code

One way of modifying the colors of a link is through CSS in the header section of the HTML file.
<style type="text/css">
A:link {
       color: #0000FF;
       }
A:visited
       {
       color: #00FF00;
       }
A:active
       {
       color: #FF0000;
       }
A:hover
       {
       color: #FF00FF;
       }
</style>
The link color is the initial colour, once clicked on the colour will change to the visited colour. The active color is used if the link is the active element on the page (eg right click) & the hover color is used when the mouse is above the link. (See http://www.w3.org/TR/REC-CSS2/selector.html#x36)

AFAIK, the link colors are global to an individual HTML page, they can't be changed individually, I might be wrong but I haven't seen references to changing individual link colors.

The relevant attributes are :
document.linkColor
document.vlinkColor
document.alinkColor

I haven't found an attribute for hovering.
Len Speed
Previous
Reply
Map
View

Click here to load this message in the networking platform