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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtaining an objects (x,y) coordinates 1

Status
Not open for further replies.

URLJones

Programmer
Jun 14, 2004
42
CA
Hi, I was wondering if there is a way to obtain an objects x and y coordinates. In other words, is there a way to get the coordinate of the top-left corner of the object on the HTML page? I would like to have a function for a drop-down menu which accepts a menuID. So, the function would look like:

function show_menu(menuID){
//get the x coordinate of the calling variable (ie, this)
//get the y coordinate of the calling variable (ie, this)
...
}

I was trying to use the "style" attribute on the calling variable (ie, this.style.top/left) to get the x and y coordinates, but it didn't seem to work. If there's a good way to do this, please let me know ;)

Thanks in advance,

--URL
 
Thanks BillyRay, that link was a great help! Much appreciated.

-- URL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top