This java script function will help you to find the HTML element position in the HTML page. It prints the top and left location of html elements like table, form e.t.c..
Features
a)The javascript function will help you to find the HTML element position.
b)The function displays the location of the HTML element present in the web page.
c)Just copy the code in to your page and use it.
Preview
Click anywhere on this page to find element location
Code
Source code:
<!-- Script by hscripts.com -->
<!-- copyright of HIOX INDIA -->
<!-- more scripts @ http://www.hscripts.com -->
<script type="text/javascript">
function showPos(e)
{
e = (e) ? e : window.event;
var element = (e.target) ? e.target: e.srcElement;
var left = element.offsetLeft;
var top = element.offsetTop;
while(element=element.offsetParent)
{
left += element.offsetLeft;
top += element.offsetTop;
}
alert("Left:"+left+"px Top:"+top+"px");
}
document.onclick=showPos;
</script>
<!-- Script by hscripts.com -->
For customization of this script or any script development, contact us at support@hscripts.com
Usage
a) Select the code given above and use ctrl+C to copy the code given above
b) Use it for free.
License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.