JavaScript: not able to alert output value

freddiemagic

New Member
The code is pretty simple.HTML:\[code\]<div class="simpleDiv" id="Child1" onmouseover="expandDiv(this);"></div>\[/code\]CSS:\[code\].simpleDiv { background-color: red; width: 100px; height: 50px; margin: 5px; margin-left: 50px; opacity: 1;} \[/code\]JavaScript:\[code\]function expandDiv(object){ alert(document.getElementById(object.id).style.height);} \[/code\]Why am I not able to alert the height of the div like this? If I alert the id or class using the function hasAttribute, thats working fine but not able to alert the css properties of the elements.Any help appreciated!
 
Back
Top