View Full Version : finding the x,y for the bottom left of a table
mahvin
10-04-2002, 06:38 PM
Just want to know how to find the x, y coordinates for bottom left corner of a table.
Thanks
zoobie
10-04-2002, 07:03 PM
I saw some free graphics program somewhere where it gives you the x/y in your statusbar...either or nonags (http://nonags.com) or webattack (http://webattack.com)
Can't you just guess till you find it? :D
adios
10-04-2002, 10:02 PM
http://www.webreference.com/dhtml/diner/realpos1/index.html
You'll need to add Table_ref.offsetHeight to the y.
<html>
<head>
<title>untitled</title>
<script type="text/javascript" language="javascript">
function DL_GetElementLeft(eElement)
{
var nLeftPos = eElement.offsetLeft;
var eParElement = eElement.offsetParent;
while (eParElement != null)
{
nLeftPos += eParElement.offsetLeft;
eParElement = eParElement.offsetParent;
}
return nLeftPos;
}
function DL_GetElementTop(eElement)
{
var nTopPos = eElement.offsetTop;
var eParElement = eElement.offsetParent;
while (eParElement != null)
{
nTopPos += eParElement.offsetTop;
eParElement = eParElement.offsetParent;
}
return nTopPos;
}
</script>
</head>
<body style="margin:0px;">
<div style="width:200px;height:200px;background:darkorange;">
<a href="javascript:;" onclick="e=document.getElementById('findme');
alert(e.id + ':\n\nx: ' + DL_GetElementLeft(e) + 'px.\ny: ' + (DL_GetElementTop(e) + e.offsetHeight) + 'px.')">
get x, y</a></div>
<table id="findme"
style="width:200px;height:200px;margin:33px;border:1px black solid;">
<tr>
<td valign="bottom">findme<br><br><font size=1>x, y</font></td>
</tr>
</table>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.