professional-javascript-10-ComputedStyleExample.htm / htm
<html> <head> <title>Computed Style Example</title> <style type="text/css"> div.special { background-color: inherit; height: 10px; width: 10px; margin: 10px; } </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()" /> <p><strong>Note:</strong> This example uses a custom Internet Explorer property and will not work in other browsers.</p> </body> </html>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.