Get Left Position of Control

Lakhangarg
Posted by Lakhangarg under JavaScript category on | Views : 3488
JavaScript function to Get the Left Position of any control.
Pass the control ID for which you want to calculate the left position.

function LeftPos(ctrlID, pos)
{
var leftCoord = 0;
while(ctrlID)
{
leftCoord += ctrlID.offsetLeft;
ctrlID= ctrlID.offsetParent;
}
return leftCoord + pos;
}


Thanks & Regards
Lakhan Pal Garg

Comments or Responses

Login to post response