Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Body aLink attribute

Body aLink attribute

Body Object Reference Body object


Definition and Usage

The aLink attribute sets or returns the value of the alink attribute in the body element.

The alink attribute specifies the color of the link when clicked (when the link is clicked).

Syntax

Set the aLink attribute:

bodyObject.aLink="

color

"

Return the aLink attribute:

bodyObject.aLink

Value Description
color Specifies the link color. See the complete A CSS color value

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the aLink attribute


Example

Example

Return the page links and the color value of the links when clicked and after being clicked:

<p>
<a href="//www.runoobb.com">

Runoob Tutorial

a

p

<p>
<a href="//www.runoobb.com/html/">

HTML Tutorial

a

p

<

script

document.write("color of unclicked link is: ") document.write(document.getElementById("runoob").link); document.write("

<

br

selected link color is: ") document.write(document.getElementById("runoob").aLink); document.write("

<

br

visited link color is: ") document.write(document.getElementById("runoob").vLink);

script

Try it »


Body Object Reference Body object