Document body X/Y position?

It’s possible to style document.body not to start at 0,0

for example:

body {width: 1000px; margin-left: auto; margin-right: auto;}

This means that X/Y of the body is not 0,0 but how can I find out what the position is using javascript?

document.body.offsetLeft; is 0 and offsetParent is null yet if I position something absolutely at 0,0 it goes to 0,0 of the window, not the body!

How can I get the x/y of the document body.


Ok still have a problem, works in everything but IE7 (and probably 6)

edit: aaah, body.offsetLeft is set in IE7!

alert(measure.offsetLeft || document.body.offsetLeft);


Ok I found a messy solution:

var measure = document.createElement('div');
document.body.insertBefore(measure, document.body.firstChild);

Oddly, the new element has an accurate offsetLeft.