element.currentStyle.backgroundColor : currentStyle : Style JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Style » currentStyle »

 

element.currentStyle.backgroundColor

















This example uses a custom Internet Explorer property and will not work in other browsers.

<html>
    <head>
        <title>Computed Style Example</title>
        <style type="text/css">
            div.special {
                background-color: inherit;
            }
        </style>
        <script type="text/javascript">
            function getBackgroundColor() {
                var oDiv = document.getElementById("div1");
                alert(oDiv.currentStyle.backgroundColor);
            }
        </script>
 
    </head>
    <body>
        <div id="div1" class="special"></div>
        <input type="button" value="Get Background Color" onclick="getBackgroundColor()" />
        
    </body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Style
» currentStyle