2010/1/6 bill <[email protected]>: > I am trying am ambitious project - a scheduling system (as part of another > application) and need some assistance. > Via AJAX I will load a div with: > a header div > a main div. > > The main div will contain 0..40 small divs that are displayed as a 7 day > schedule. > I can do all this. > > The user will click on a spot in the main div to create an appointment or > will click on one of the small divs that represent existing appointments. > > now for the part with which I need help. > If they click on a spot in the main div that does not have a appointment div > I need to determine the coordinates of the click both in terms of the main > div and the viewport (as the content of the main div will scroll) so I can > display a div near the click with a form to fill in to create an > appointment. > > If they click on an existing appointment div I need to determine the > coordinates and the div's ID. > > From what little I know about prototype I presume I need an observer of the > main div, but I do not understand how to write it and then process the > event information. > > Suggestions, links, and/or a tutorial would be much appreciated. > > -- > 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. > >
Event bubbling is probably the thing you need to read about. Essentially, the outer div has the click observer and you use http://api.prototypejs.org/dom/event.html#findelement-class_method to find the element that triggered the event. If you really need the x/y coords, then http://api.prototypejs.org/dom/event.html#pointer-class_method, http://api.prototypejs.org/dom/event.html#pointerx-class_method and http://api.prototypejs.org/dom/event.html#pointery-class_method can come to your rescue. -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling
-- 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.
