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..


  • 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.


Click anywhere on this page to find element location


Source code
<!--Script by>
<!-- more scripts @ -->
<script type="text/javascript">
function showPos(e)
e = (e) ? e : window.event;
var element = ( ? e.srcElement;
var left = element.offsetLeft;
var top= element.offsetTop;
left += element.offsetLeft;
top+= element.offsetTop;
alert("Left:"+left+"px Top:"+top+"px");
<!-- Script by -->
  • 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


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


Related Scripts

Free Javascript Scripts

Ask Questions

Ask Question