⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computedstyleexample2.htm

📁 这是javascript高级程序设计的源码
💻 HTM
字号:
<html>
    <head>
        <title>Computed Style Example</title>
        <style type="text/css">
            div.special {
                background-color: red;
                height: 10px;
                width: 10px;
                margin: 10px;
            }
        </style>
        <script type="text/javascript">
            function getBackgroundColor() {
                var oDiv = document.getElementById("div1");
                alert(document.defaultView.getComputedStyle(oDiv, null).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 the DOM style methods and will fail in Internet Explorer.</p>
    </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -