title: Find element's position in browser scroll
body: <p>i need some help about finding elements position.
  im working on an e-book reader, also its all Html with css.
  All html sectioned page by page, and i have to find an element like this </p>
  
  <p><code>&lt;span name="Note" style="background-color:rgb(255,255,204)"&gt;Example&lt;/span&gt;</code></p>
  
  <p>Everyone suggests code like this;</p>
  
  <pre><code>function position(elem) {
      var left = 0,
          top = 0;
  
      do {
          left += elem.offsetLeft;
          top += elem.offsetTop;
      } while ( elem = elem.offsetParent );
  
      return [ left, top ];
  }position(document.getElementsByName('Note')[0]);
  </code></pre>
  
  <p>but it does not work for me; I need element's real position in scroll with JavaScript.</p>