doctor_james Posted May 2, 2008 Share Posted May 2, 2008 Hi, I have a button and I want it do open a box next to itself on mousemove or mouseover events. But since the position of this button is dynamic , I don't know to set top and left values . any ideas ..? thanks in advance. Quote Link to comment Share on other sites More sharing options...
xenophobia Posted May 6, 2008 Share Posted May 6, 2008 I would suggest you to use the prototype.js to solve all your js problems. prototype is a javascript library file that provide a lot of function that can ease your task in programming javascript. (You can get the element's position easily.) www.prototypejs.org Quote Link to comment Share on other sites More sharing options...
wrongmove18 Posted May 6, 2008 Share Posted May 6, 2008 var top = document.getElementById("ID").offsetTop; var left = document.getElementById("ID").offsetLeft; Quote Link to comment Share on other sites More sharing options...
xenophobia Posted May 6, 2008 Share Posted May 6, 2008 That not always the true position. Especially they are relatively positioned. The position are counted to their parent node instead of the actual document. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.