Hi Bill, Using Event.PointerX() and Event.PointerY() you can get the absolute position of the mouse on the page. Using Element.Layout you can get the exact position of your image.
If you substract the layout's left value to PointerX and the layout's top value to PointerY, you should have the X/Y position relative to top/left corner of your image. More simple but I am not sure it is crossbrowser supported, events *may* have clientX and clientY attributes which *may* contain what you're looking at (if your event is attached to the img DOM object). Eric On May 29, 12:29 pm, bill <[email protected]> wrote: > On 5/29/2011 12:56 AM, venu gupta wrote:> Hi Bill, > > You can do both the ways . But I personally prefer to > > have it in the main page which is always loaded. > > I obviously sounded as if I know more than I do. > I need some help in the form of the observer and with determining > the x/y location of the click and/or determining the id of the > div clicked upon. > > > > > > > On Sun, May 29, 2011 at 12:58 AM, bill <[email protected] > > <mailto:[email protected]>> wrote: > > > I am dynamically generating a div which is loaded via AJAX. > > It is a schedule, with a background image (loaded with > > <img..., not css - so it scrolls) and the appointments as > > superimposed divs. > > > If the user clicks on the background image (not on a div) I > > need to determine the x and y coordinates of the click on > > the image, not in the viewport. (ie: the same coordinates > > regardless of how the image has scrolled) > > > If the user clicks on a div (superimposed on the image) I > > need to return the id of the div. > > It seems that I could just have one observer watching the > > outer div and bubble up the information, but I just can't > > seem to get started. > > > I can load the js with the page or I can have it in the > > main page that is always loaded. > > > -- > > Bill Drescher > > william {at} TechServSys {dot} com > > > -- > > You received this message because you are subscribed to the > > Google Groups "Prototype & script.aculo.us > > <http://script.aculo.us>" group. > > To post to this group, send email to > > [email protected] > > <mailto:[email protected]>. > > To unsubscribe from this group, send email to > > [email protected] > > <mailto:prototype-scriptaculous%[email protected]>. > > For more options, visit this group at > > http://groups.google.com/group/prototype-scriptaculous?hl=en. > > > -- > > Regards, > > Venu Kumar Bukka > > -- > > You received this message because you are subscribed to the > > Google Groups "Prototype & script.aculo.us" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/prototype-scriptaculous?hl=en. > > -- > Bill Drescher > william {at} TechServSys {dot} com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
