PhantomSnake (talk | contribs) mNo edit summary |
PhantomSnake (talk | contribs) mNo edit summary |
||
Line 26: | Line 26: | ||
return reltop; | return reltop; | ||
} | |||
function findDistanceX(out, in) { | |||
var distx = 0; | |||
if (in.offsetParent) { | |||
while (in.offsetParent) { | |||
distx += in.offsetLeft; | |||
in = in.offsetParent; | |||
if(in.offsetParent == out.offsetParent) { | |||
break; | |||
} | |||
} | |||
} else if (in.x) { | |||
distx = out.x - in.x; | |||
} | |||
return distx; | |||
} | |||
function findDistanceY(out, in) { | |||
var disty = 0; | |||
if (in.offsetParent) { | |||
while (in.offsetParent) { | |||
disty += in.offsetTop; | |||
in = in.offsetParent; | |||
if(in.offsetParent == out.offsetParent) { | |||
break; | |||
} | |||
} | |||
} else if (in.y) { | |||
disty = out.y - in.y; | |||
} | |||
return disty; | |||
} | } | ||
Revision as of 18:38, 28 June 2006
<plainhtml>
<script type="text/javascript">
var useFloats = true;
function findRelPosX(obj) { var relleft = 0;
if (obj.offsetParent) { relleft = obj.offsetLeft; } else if (obj.x) { relleft = obj.x; }
return relleft; }
function findRelPosY(obj) { var reltop = 0;
if (obj.offsetParent) { reltop = obj.offsetTop; } else if (obj.y) { reltop = obj.y; }
return reltop; }
function findDistanceX(out, in) { var distx = 0;
if (in.offsetParent) { while (in.offsetParent) { distx += in.offsetLeft; in = in.offsetParent;
if(in.offsetParent == out.offsetParent) { break; } } } else if (in.x) { distx = out.x - in.x; }
return distx; }
function findDistanceY(out, in) { var disty = 0;
if (in.offsetParent) { while (in.offsetParent) { disty += in.offsetTop; in = in.offsetParent;
if(in.offsetParent == out.offsetParent) { break; } } } else if (in.y) { disty = out.y - in.y; }
return disty; }
function findPosX(obj) { var curleft = 0;
if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft; obj = obj.offsetParent; } } else if (obj.x) { curleft += obj.x; } return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop; obj = obj.offsetParent; } } else if (obj.y) { curtop += obj.y; } return curtop; }
</script>
</plainhtml>