Simon Willison’s Weblog

Help needed

Does anyone know if it is possible to find an HTML element’s exact position on the page (in terms of pixels-from-the-top and pixels-from-the-left) using javascript? The element I have in mind is an image that has not had any positioning applied to it, but I imagine any solution will work for other elements as well. I need something that works in Mozilla/Phoenix, although a solution for IE would be nice as well. It’s for a bookmarklet I’m thinking of writing.

This is Help needed by Simon Willison, posted on 7th February 2003.

Next: Image Drag bookmarklet

Previous: Real girls eat beef

Previously hosted at http://simon.incutio.com/archive/2003/02/07/helpNeeded