javascript_howto thread: SV: Re: SV: How to find the absolute position of an object
Yeah, sorry I wasn't clear about that...
Thanks Van.
However, if this is an option, I'd position the image absolutely to
begin with (for easy code...).
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: Van Knowles [mailto:vknowles@s...]
Skickat: den 9 december 2002 14:56
Till: JavaScript HowTo
=C4mne: [javascript_howto] Re: SV: How to find the absolute position of
an
object
offsetLeft and offsetTop do not give ABSOLUTE position on a page - they
give position relative to the containing object.
If the image you want is inside another element, you have to work your
way
up the tree by using the offsetParent property and adjusting the
position
until you run out of parents.
-Van
> Hi Trent,
In IE 4+, Netscape 6+, and Opera (however, instable in version 6 but ok
in version 7), you can use the offsetLeft and offsetTop property for the
image, as in:
<img src=3D3D"yourImage.jpg" alt=3D3D"" width=3D3D"160" height=3D3D"120"
=3D
border=3D3D"0"
onClick=3D3D"alert('Left: ' + this.offsetLeft + '\nTop: ' +
this.offsetTop);">
/Robert
-----Ursprungligt meddelande-----
Fr=3DE5n: Trent Blackburn [mailto:puzzlepants@m...]=3D20
Skickat: den 8 december 2002 23:48
Till: JavaScript HowTo
=3DC4mne: [javascript_howto] How to find the absolute position of an =3D
object
Hello All
Is there a way to find the absolute position of an object when the
page=3D20 loads?
What I have is an image on the page, and I want to place a table in a
div=3D20 over that image in an attempt to create a grid, but I run into
problems=3D20 when the user's screen resolution changes. So, I would
like
to find the=3D20 absolute position of the image and input those
cordinates
into the div.
Thanks in advance.
---
Change your mail options at http://p2p.wrox.com/manager.asp or=3D20 to
unsubscribe send a blank email to