element.currentStyle.margin : currentStyle « Style « JavaScript Tutorial






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: red;
                margin: 10px;
            }
        </style>
        <script type="text/javascript">
            function getBackgroundColor() {
                var oDiv = document.getElementById("div1");
                alert(oDiv.currentStyle.margin);
            }
        </script>
 
    </head>
    <body>
        <div id="div1" class="special"></div>
        <input type="button" value="Get Background Color" onclick="getBackgroundColor()" />
        
    </body>
</html>








22.5.currentStyle
22.5.1.element.currentStyle.backgroundColor
22.5.2.element.currentStyle.height
22.5.3.element.currentStyle.margin