I have a page with a div layer. I need to be able to access the height attribute using javascript:
[code=html]<style>
#testDiv {
margin: 0 auto;
width: 545px;
margin: 10px 0 10px 23px;
height: 300px;
}
</style>
<body>
<script type=”text/javascript”>
function getHeight(){
var h = document.getElementByI(‘testDiv’).style.height;
alert(h);
}
</script>
<div id = “testDiv”>
Content
</div>
<a href =”javascript:getHeight()”>click</a>
</body>
Clicking the link calls the function which should alert with the div height attribute. It appears blank.
If i explicitly define the div height in the div itself clicking the link returns the height
[code=html]
<div id = “testDiv” style=”height:300px”>
Content
</div>
Is there anyway I can access the height attribute if it is set in the CSS decleration?
Thanks
Beedge