Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving element coordinates relative to the window

Status
Not open for further replies.

NorthStarDA

IS-IT--Management
Mar 16, 2004
614
US
Hi,

I need to know how to retrieve a form elements x and y coordinates in pixels relative to the window itself. I have experimented with using offsetLeft and offsetTop but these are only relative to the parent element. The purpose of this is to move a div next to a specified form field, but i need the proper coordinates of the form field to make that happen.

Any ideas?


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
You would be better off asking this in the JavaScript forum (forum216), as it's probably going to be a JS solution. I don't think you can do this with HTML / CSS alone if you have many nested elements.

This has been asked at least 2 times I can remember, both posts referring to the same answer (by stormbind, I believe)... so you might want to do a search for the post first.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top