javascript: get height of div and use it in other div

Viewed 1277

I want to use javascript to get the height of a responsive div, and use the output in another div. But I'm no good in javascript at all...

So far I've come up with:

<script language="JavaScript">
var offsetHeight = document.getElementById("myDiv").offsetHeight;
var curr_width = parseInt(offsetHeight.style.height); 
offsetHeight.style.height = (offsetHeight);
</script>

<div id="mydiv"></div>
<div id="offsetHeight" style="top:0px"></div>

So what I want is that when I resize the document, the height of mydiv is used for the style="top" value...

Anyone who can help me out? Would be wonderful!

3 Answers
Related