adam84 Posted September 13, 2007 Share Posted September 13, 2007 does anyone know a JS method that will return either the X or Y coords on a certain object??? I want to get the Y coord. Thanks Link to comment https://forums.phpfreaks.com/topic/69141-getting-an-objects-location/ Share on other sites More sharing options...
mainewoods Posted September 17, 2007 Share Posted September 17, 2007 from quirksmode.com: function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } Link to comment https://forums.phpfreaks.com/topic/69141-getting-an-objects-location/#findComment-349796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.