?? accessingstylesheetsexample5.htm
字號:
<html>
<head>
<title>Accessing Style Sheets Example</title>
<style type="text/css">
div.special {
background-color: red;
height: 10px;
width: 10px;
margin: 10px;
}
</style>
<script type="text/javascript">
function changeBackgroundColor() {
var oDiv = document.getElementById("div1");
oDiv.style.backgroundColor = "blue";
alert(oDiv.style.item(0));
}
</script>
</head>
<body>
<div id="div1" class="special"></div>
<div id="div2" class="special"></div>
<div id="div3" class="special"></div>
<input type="button" value="Change Background Color" onclick="changeBackgroundColor()" />
<p><strong>Note:</strong> This example uses DOM style methods which are not supported by Internet Explorer. Therefore, an error will occur when attempting to run this example in IE.</p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -