backgroundColor : backgroundColor « Style « JavaScript Tutorial






<html>
<head>
<title>Style Example</title>
<script type="text/javascript">
    function getColor() {
        var oDiv = document.getElementById("myDiv");
        alert(oDiv.style.backgroundColor);
    }
</script>
</head>
<body>
<div id="myDiv" style="background-color: red; height: 50px; width: 50px"></div><br />
<input type="button" value="Get Background Color" onclick="getColor()" />
</body>
</html>








22.1.backgroundColor
22.1.1.backgroundColor
22.1.2.Get and set node background color
22.1.3.div.style.backgroundColor="#00f";