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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding a position of an element

Status
Not open for further replies.

Sniipe

Programmer
Oct 9, 2006
115
IE
Hello, I have a textbox and I would like to find its position so that I can open another window directly underneath. If I change resolution, the textbox positon (screenx, screeny) will move.

I have tried these:

alert(document.getElementById("txtFromDate").offsetLeft) -> 0
alert(document.getElementById("txtFromDate").clientLeft) -> undefined
alert(document.getElementById("txtFromDate").scrollLeft) -> 1

I think I have the right position, but I perhaps have it in relation to the parent which is a <td>, which itself is inside a <table> which itself is inside a frame
Any ideas?

Thanks
 
Thanks for the link, it was very helpful. I have almost finished the code. The problem is that when you open a new window you have screenx and screeny coordinates. It would work fine if the screen was fullscreen and had no toolbars at the top.

Problem is that the screen my be windowed and different browers have different amount of toolbars above the web page. I need to find the screen position of an element.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top