computedstyleexample.htm
来自「这是javascript高级程序设计的源码」· HTM 代码 · 共 26 行
HTM
26 行
<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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?