DOM methods, such as document.getElementById(), create objects that point to - and contain specific information about the - specified HTMLElement element or set of elements.
Unfortunately, a property .styleonly knows about style properties defined using the same function. In the example below, clicking what color?will not work until you click change color.
<html>
<head>
<script>
function whatColor() {
var d = document.getElementById( 'ddd' );
alert( d.style.backgroundColor );
}
function changeColor() {
var d = document.getElementById( 'ddd' );
d.style.backgroundColor='orange';
}
</script>
<style>
#ddd {
background-color:gray;
}
</style>
</head>
<body>
<input type="button" onclick="whatColor();" value="what color?" />
<input type="button" onclick="changeColor();" value="change color" />
<div id="ddd"> </div>
</body>
</html>
PKK getComputedStyle currentStyle (IE, , ) http://www.quirksmode.org/dom/getstyles.html
, , jQuery, : http://api.jquery.com/css/