Properti HTML DOM Tubuh bgcolor
Definisi dan Penggunaan
bgcolor set properti atau mengembalikan nilai dari atribut bgcolor dari elemen body. x
Atribut bgcolor menentukan warna latar belakang dokumen.
tatabahasa
Pengaturan properti bgcolor:
bodyObject.bgColor="color"
Kembali sifat bgcolor:
bodyObject.bgColor
值 | 描述 |
---|---|
color | 指定了背景颜色。查看完整的 CSS 颜色值 |
Dukungan Browser
Semua browser utama mendukung properti bgcolor
contoh
contoh
Kembali atribut bgcolor dari elemen body:
<html>
<body id="w3s" bgcolor="#E6E6FA">
<script>
document.write("The background color is: ")
document.write(document.getElementById("w3s").bgColor);
</script>
</body>
</html>
<body id="w3s" bgcolor="#E6E6FA">
<script>
document.write("The background color is: ")
document.write(document.getElementById("w3s").bgColor);
</script>
</body>
</html>
Coba »
tubuh Object