title: Getting absolute position of an element relative to browser
body: <p>I have a div set to the css class float with float being:</p>
  
  <pre><code>.float {
  display:block; 
  position:fixed; 
  top: 20px;
  left: 0px;
  z-index: 1999999999;
  }
  * html .float {position:absolute;}
  </code></pre>
  
  <p>This class causes the element to stay in a fixed position on the page (the *html part is to make it work in IE). I am using javascript to shift the position of the element horizontally and vertically.</p>
  
  <p>I need to get the absolute position of the div relative to the browser window in javascript (how many pixels from the top and left of the browser window the div is). Right now, I am using the following:</p>
  
  <pre><code>pos_left = document.getElementById('container').offsetLeft;
  pos_top = document.getElementById('container').offsetTop;
  </code></pre>
  
  <p>The code above works for IE, Chrome, and FF, but in Opera it returns 0 for both. I need a solution that works for all of those browsers. Any ideas?</p>
  
  <p>Btw: Keeping tracking of the changes made by javascript is possible, but that is not the solution I am looking for due to performance reasons. Also, I am <em>not</em> using jquery.</p>