Hallo,
I am trying to get the height of a div that I defined with css. It sounds stupid but I would like to be able to change my div height without having to change the function.
the code is essentially this:
But doesn't work at all and I don't understand why. Any idea? thanks
I am trying to get the height of a div that I defined with css. It sounds stupid but I would like to be able to change my div height without having to change the function.
the code is essentially this:
Code:
<html>
<head>
<style>
div.test {
width:150px;
height:150px;
overflow:hidden;
}
</style>
<script language="JavaScript">
function getHeight()
{
h = document.getElementById('test').style.height;
document.write(h);
}
</script>
</head>
<body onLoad="getHeight();">
<div class="test" id="test">
</div>
</body>
</html>
But doesn't work at all and I don't understand why. Any idea? thanks