Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to find what control is in some position?

Reply
Thread Tools

How to find what control is in some position?

 
 
jkarpago
Guest
Posts: n/a
 
      04-01-2006
Hi:
I need to find what control is in some position given.
I mean, if I give the values left: 200px and top 300px I need to know
what control in the page is in that position, or if there is not any.
Can anyone help me, please?

Thanks so much.

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-01-2006
jkarpago wrote:

> I need to find what control is in some position given.
> I mean, if I give the values left: 200px and top 300px I need to know
> what control in the page is in that position, or if there is not any.


You will need a bubbling event, then evaluate its event target in its event
listener. If that target is the element on which you are listening for
the event, none of its descendants handled it. Otherwise, the computed
coordinates of the handling descendant indicate its location. This
approach is efficient (AIUI, O(1)) but unprecise insofar that more than
one element can be at that position, and only the topmost element this
event applies to will be identified as event target.

Another more precise approach is to compute the area each element covers,
and then run a comparison for each element, in O(n).

Bottom line:
Describe what you are up to, not what you /think/ you need to know to do it.


PointedEars
 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      04-01-2006

jkarpago wrote:
> Hi:
> I need to find what control is in some position given.
> I mean, if I give the values left: 200px and top 300px I need to know
> what control in the page is in that position, or if there is not any.
> Can anyone help me, please?
>
> Thanks so much.


For IE use document.elementFromPoint(x,y) method.

For the Co you need to dig it out manually as suggested.

 
Reply With Quote
 
jkarpago
Guest
Posts: n/a
 
      04-03-2006
Thanks for your help. Thatīs what I imagine, but I wanted to know if
there was another solution.
Thanks so much

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 3 02-14-2011 05:28 AM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 0 02-10-2011 05:18 PM
Can some one Explain How To Find File and Leech them Accully How to find all Articals Related to that binary callejachris@tpg.com.au Computer Support 2 12-04-2005 02:15 PM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM



Advertisments