Close
jGuru Forums
Posted By: Anonymous Posted On: Monday, December 12, 2005 02:46 AM
hi all
i just want to get the pixel(coordinate position )of a text box .
pls help me in this matter if any buddy can ?
Re: How To Get Coordinate position of textbox
Posted By: Almagest_FUTT Posted On: Monday, December 12, 2005 07:43 AM
function getAbsolutePosition(element){ var ret = new Point(); for(; element && element != document.body; ret.translate(element.offsetLeft, element.offsetTop), element = element.offsetParent ); return ret;}function Point(x,y){ this.x = x || 0; this.y = y || 0; this.toString = function(){ return '('+this.x+', '+this.y+')'; }; this.translate = function(dx, dy){ this.x += dx || 0; this.y += dy || 0; }; this.getX = function(){ return this.x; } this.getY = function(){ return this.y; } this.equals = function(anotherpoint){ return anotherpoint.x == this.x && anotherpoint.y == this.y; };}