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

HTML DOM Body link attribute

Body link attribute

Body Object Reference Body object


Definition and Usage

The link attribute sets or returns the value of the link attribute of the body element.

The link attribute specifies the color of links in the document that have not been clicked or visited.

Syntax

Set the link attribute:

bodyObject.link="

color

"

Return the link attribute:

bodyObject.link

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

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the link attribute


Example

Example

Return the color of links in the document that are unclicked, clicked, and after being visited:

<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