You are here: Reference > JavaScript > client-side > HTML DOM > properties > alinkColor (document)

alinkColor property (document)

Browser support:
Sets or retrieves the color of active hypertext links in the entire document.
This property is equivalent to the aLink property.
The preferred solution to set the color of active links is to use the active pseudo with the color style property: 'a:active {color:#00FFFF;}'.
See Example 2 for details.

Syntax:

object.alinkColor;
You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

A legal color value. It can be a hexadecimal, RGB or predefined color value. For more information, see the page for colors.
Default: #0000FF.

Example HTML code 1:

This example illustrates the use of the alinkColor property:
<head>
    <script type="text/javascript">
        document.alinkColor = "green";
        document.linkColor = "red";
        document.vlinkColor = "black";
    </script>
</head>
<body>
    Click on the following hyperlinks to see the default, normal and visited states:
    <br /><br />
    <a href="#first">Hyperlink text</a>
    <br /><br />
    <a href="#second">Hyperlink text</a>
    <br /><br />
    <a href="#third">Hyperlink text</a>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the color style property for hypertext links:
<head>
    <style>
        a:link { color: red; }
        a:visited { color: black; }
        a:active { color: green; }
    </style>
</head>
<body>
    Click on the following hyperlinks to see the default, normal and visited states:
    <br /><br />
    <a href="#first">Hyperlink text</a>
    <br /><br />
    <a href="#second">Hyperlink text</a>
    <br /><br />
    <a href="#third">Hyperlink text</a>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content