Click to See Complete Forum and Search --> : getByCoor?
router
08-13-2003, 09:07 AM
Hello everybody!
How can i get an object if i know its position in the window?
I wanna to know if there is an object in a deternminate coordinate and what it is.
Does something similar to ''getElementById' exist to do it using its coordinates?
Thanks in advance!
Router :)
Khalid Ali
08-13-2003, 09:43 AM
sounds like pain in the neck approach.
What possibly yu can do is get all the html elements list on the page and then get each elements co-ordinates and see whose position matches with the co-ords that you already have...
How ever I am sure there is a better way of doing whatever you are trying to do.
router
08-13-2003, 11:28 AM
OK, i had have the same idea: using DOM to get all elements.
I search something easier if it exists ;).
I'm doing some classes of GUI for my interfaz(checkbox,dialogBox...). Now, i'm doing a tooltip. To do it, i don't wanna to modify the others object. So i've thougth programming a new object called 'tooltip'. When the object 'listens' that the cursor is quiet, it display the message. The problem is that i have to know what is the object where the cursor is over. I know the coordinates of cursor, but bot the object.
Any idea is wellcome!!
Thank in advance!
Router
router
08-14-2003, 05:44 AM
Finally i've found what i'm looking for:
obj = document.elementFromPoint(x,y);
Returns the object that it's in these coordinates(x,y);
It works rigth!
I hope that it helps someone else!
Router :)