Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i get the Top and Left positioning of an INPUT ?

Status
Not open for further replies.

mtawk

Programmer
Nov 6, 2001
26
IQ
Is there a way to get the Top and left positionning of a selected input type text ?
Thanks
 
One way to do this is to add up the offsetLeft and offsetTop properties starting at your element, and recursing up the offsetParent chain. Something like:
Code:
var start = <starting element>
for( var p = start; p != null; p = p.offsetParent ) {
    start.myLeft += p.offsetLeft;
    start.myTop  += p.offsetTop;
}
Cheers, Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top