bgColor 属性可设置或者返回 body 元素的 bgcolor 属性值。x
bgcolor 属性指定了文档的背景颜色。
设置 bgColor 属性:
返回 bgColor 属性:
所有主要浏览器都支持 bgColor 属性
返回body元素的bgcolor属性值:
<html> <body id="w3s" bgcolor="#E6E6FA"> <script> document.write("The background color is: ") document.write(document.getElementById("w3s").bgColor); </script> </body> </html>