title: Getting the height of a <DIV> - returns 'undefined'
body: <p>I have a problem getting the height of a  (the one in the code below, with class="post_div"). And I want to return with a document.write whitin the HTML body - maybe later using it as height for other elements, that I want to be equal. I have tried every possible code for getting the height of such an element, but every time it returns 'undefined'. I have also tried setting height=auto for the DIV. I am almost sure my problem not has to do with the way I get the height, but have no other idea for what else it could be! Therefore I have choosen to bother you with the full structure of my coding. The JavaScript is placed in a separate document containing only the following statement:</p>
  
  <pre><code>var result=document.getElementById('postHeight').offsetHeight;
  </code></pre>
  
  <p>My HTML document looks like this</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;head&gt;
  &lt;title&gt;...&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" media="all" href="C:\Users\Lasse\Desktop\hg2\hg2.css" /&gt;
  &lt;script src="C:\Users\Lasse\Desktop\hg2\hg2.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script&gt;document.write(result)&lt;/script&gt;
  
  &lt;div id="postHeight" class="post_div"&gt;
  ...             
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Hope you can help! Thanks!</p>