Cross-browser javascript function to find actual position of an element in page
I got this function:


      function findPos(obj) {
          var curleft = curtop = 0;
          if (obj && obj.offsetParent) {
            do {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
          }
          return [curleft,curtop];
      }


to find and element's actual position in page.

but for some reason it throws me an error in IE;
how do i fix this to cross-browser work?

thanks alot.
Cross-browser javascript function to find actual position of an element in page
===

I got this function:


      function findPos(obj) {
          var curleft = curtop = 0;
          if (obj && obj.offsetParent) {
            do {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
            } while (obj = obj.offsetParent);
          }
          return [curleft,curtop];
      }


to find and element's actual position in page.

but for some reason it throws me an error in IE;
how do i fix this to cross-browser work?

thanks alot.