HTML Element Position

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

  • The javascript function will help you to find the HTML element position.
  • The function displays the location of the HTML element present in the web page.
  • Just copy the code in to your page and use it.

Preview

Click anywhere on this page to find element location

Downloads

Source code
<!--Script by hscripts.com-->
<!-- more scripts @ https://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 -->
  • Release Date - 02-01-2007
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Select the code given above and use ctrl+C to copy the code given above
  • Use it for free.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question