atribut tautan HTML DOM Tubuh
Definisi dan Penggunaan
menghubungkan set properti atau mengembalikan nilai properti dari elemen link tubuh.
atribut tautan menentukan dokumen, klik pada warna link yang dikunjungi tidak.
tatabahasa
Mengatur properti link:
bodyObject.link="color"
Kembali Link atribut:
bodyObject.link
值 | 描述 |
---|---|
color | 指定链接颜色。查看完整的 CSS 颜色值 |
Dukungan Browser
Semua browser utama mendukung atribut tautan
contoh
contoh
Pengembalian dokumen tidak mengklik pada link, klik pada link, klik pada link untuk mengakses warna belakang:
<html>
<body id="w3s" link="blue" alink="green" vlink="red">
<p><a href="http://www.w3cschool.cc">W3CSchool.cc</a></p>
<p><a href="http://www.w3cschool.cc/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 href="http://www.w3cschool.cc">W3CSchool.cc</a></p>
<p><a href="http://www.w3cschool.cc/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>
Coba »
tubuh Object