Sri lanka web server - 278Part IIIDocument Objects ReferenceTable 15-8(continued) Returned StringElement Component

278Part IIIDocument Objects ReferenceTable 15-8(continued) Returned StringElement Component at Coordinate PointscrollbarPageDownScrollbar page-down regionscrollbarPageLeftScrollbar page-left regionscrollbarPageRightScrollbar page-right regionscrollbarPageUpScrollbar page-up regionscrollbarRightScrollbar right arrowscrollbarUpScrollbar up arrowscrollbarVThumbScrollbar thumb on vertical barhandleBottomResize handle at bottomhandleBottomLeftResize handle at bottom lefthandleBottomRightResize handle at bottom righthandleLeftResize handle at lefthandleRightResize handle at righthandleTopResize handle at tophandleTopLeftResize handle at top lefthandleTopRightResize handle at top rightYou do not have to use this method for most collision or event detection, however. The eventobject s srcElementproperty returns a reference to whatever object receives the event. ExampleListing 15-24 demonstrates how the componentFromPoint()method can be used to determineexactly where a mouse event occurred. As presented, the method is associated with a textareaobject that is specifically sized to display both vertical and horizontal scrollbars. As you clickvarious areas of the textareaand the rest of the page, the status bar displays information aboutthe location of the event with the help of the componentFromPoint()method. The script utilizes a combination of the event.srcElementproperty and thecomponentFromPoint()method to help you distinguish how you can use each one for differ- ent types of event processing. The srcElementproperty is used initially as a filter to decidewhether the status bar will reveal further processing about the textareaelement s eventdetails. The onmousedownevent handler in the bodyelement triggers all event processing. IE eventsbubble up the hierarchy (and no events are cancelled in this page), so all mousedowneventseventually reach the bodyelement. Then, the whereInWorld()function can compare eachmousedownevent from any element against the text area s geography. Listing 15-24: Using the componentFromPoint() Method