Body linkProperty
Body Object
Definition and Usage
The link property sets or returns the value of the link attribute of the body element.
The link property specifies the color of unvisited links in the document.
Syntax
Set the link property:
bodyObject.link="color"
Return the link property:
bodyObject.link
| Value | Description |
|---|---|
| color | Specifies the link color. See the completeCSS color values |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the link property.
Example
Example
Return the colors of unvisited links, active links, and visited links in the document:
<p><a href="//www.exampleb.com">Example</a></p>
<p><a href="//www.exampleb.com/html/">HTML Tutorial</a></p>
<script>document.write("Unvisited link color: ")
document.write(document.getElementById("example").link);
document.write("<br>Active link color: ")
document.write(document.getElementById("example").aLink);
document.write("<br>Visited link color: ")
document.write(document.getElementById("example").vLink);</script>
Try it Yourself »
Body Object Other Extensions