<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>