title: Read the width of a div with JavaScript
body: <p>I'm trying to read the width of a div without jQuery. The code I'm using is: </p>
  
  <p>JS: </p>
  
  <pre><code>var windowwidth = parseInt(document.getElementById("window").style.width);
  window.onload = function start() {
      alert(windowwidth);
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="window"&gt;
      &lt;p&gt;Lorem ipsum dolor sit amet.&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>#window {
      height: 250px;
      margin: 0 auto;
      width: 600px;
  }
  </code></pre>
  
  <p>I don't understand why this isn't working, I've looked all over this site and google and can't figure out a solution. I don't want to use jQuery for this (it's a small custom HTML5 script so I don't need that huge library for one little thing) and even when I try the jQuery method, it still doesn't work. </p>