Body link 屬性

定義和用法
link 屬性可設置或者返回 body 元素的 link屬性值。
link 屬性指定了文檔中鏈接未被點擊訪問的顏色。
語法
設置 link 屬性:
bodyObject.link="color"
返回 link 屬性:
bodyObject.link
值 | 描述 |
---|---|
color | 指定鏈接顏色。查看完整的 CSS 顏色值 |
瀏覽器支持
所有主要瀏覽器都支持 link 屬性
實例
實例
返回文檔中未被點擊鏈接,點擊鏈接,點擊訪問后的鏈接顏色:
<html>
<body id="w3s" link="blue" alink="green" vlink="red">
<p><a >W3CSchool.cc</a></p>
<p><a href="http://www.vxbq.cn/s/html/">HTML Tutorial</a></p>
<script>
document.write("Link color is: ")
document.write(document.getElementById("w3s").link);
document.write("<br>Active link color is: ")
document.write(document.getElementById("w3s").aLink);
document.write("<br>Visited link color is: ")
document.write(document.getElementById("w3s").vLink);
</script>
</body>
</html>
<body id="w3s" link="blue" alink="green" vlink="red">
<p><a >W3CSchool.cc</a></p>
<p><a href="http://www.vxbq.cn/s/html/">HTML Tutorial</a></p>
<script>
document.write("Link color is: ")
document.write(document.getElementById("w3s").link);
document.write("<br>Active link color is: ")
document.write(document.getElementById("w3s").aLink);
document.write("<br>Visited link color is: ")
document.write(document.getElementById("w3s").vLink);
</script>
</body>
</html>
嘗試一下 ?
