Calculating position on a page

by "Peter-Paul Koch" <gassinaumasis(at)hotmail.com>

 Date:  Wed, 07 Jun 2000 11:52:25 GMT
 To:  hwg-techniques(at)mail.hwg.org
  todo: View Thread, Original

Hello,

I've run into a JavaScript problem that I can't solve right now. I hope 
someone can help me find a solution.

The case:
We want to make a DHTML banner where onMouseOver a new layer appears below 
the banner with extra information, links etc. This new layer should fit 
seamlessly to the banner.

The problem:
We need to know the position of the banner on the page so we can give the 
correct coordinates to the layer. However, we cannot predict exactly where 
on the page the banner will be placed. This campaign will run on several 
sites where the banner will have different positions.
In addition, the banner is placed directly in the HTML, so its position is 
relative, not absolute.

The apparent solution:
Use JavaScript to read out what the position of the banner is on the page, 
then calculate the coordinates for the layer.

The problem with the apparent solution:
It's impossible to read out the top and left of a relatively positioned 
element. Even with an absolutely positioned element, it's only possible in 
NN4 and IE5.

My question:
What to do now? Can anyone think of a nice trick to read out the position of 
the banner without using top and left?

Thanks for any insight,

ppk
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA