|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
Recipe 13.8: Determining the Location of a Nonpositioned Element
NN 6, IE 5
You want to ascertain the pixel coordinates of an element that the browser has placed during normal page flow.
This function is compatible with browsers that support W3C DOM element-referencing syntax.
The typical purpose of establishing the absolute location of an element on the page is to position some other element on it or in relation to it. Because the location of inline elements can vary widely with the browser window size and font situation, the values need to be calculated after the page has loaded, is reflowed in response to other dynamic content additions and deletions, or the window is resized.
Although some browser versions report the accurate value simply via the
This function is not needed for CSS-type absolute-positioned elements because you can obtain the correct coordinates directly via the
Recipe 11.12 for reading initial style properties set in
Return to the Web Development DevCenter.