Assigning multiple functions to document.on... events

Last post 11-15-2007 11:00 AM by DisturbedBuddha. 1 replies.

Sort Posts:

  • Assigning multiple functions to document.on... events

    11-15-2007, 9:45 AM

    Does anyone know how to assign multiple functions to events like document.onmousedown?

    I don't want to overwrite the event handlers placed there by previous script libraries etc.

    Essentially, all I want to do is get the mouse state (position, buttons pressed etc) without having to assign an event for it.

    M

    This post with no guarantees associated, being a personal submittal with no affiliation intended or implied.
    <mc:WittyRemark runat="server" id="wr1" />
  • Re: Assigning multiple functions to document.on... events

    11-15-2007, 11:00 AM
    Answer

    You can have multiple event handlers for the same event, adding them however you wish (onwhatever="someFunction()", addHandler, addEventListener, etc.).  The won't overwrite each other.  However, different browsers bubble events differently, so you might not know in which order the handlers execute, which creates a remote possibilities of unexpected results.

    When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


    My latest ASP.NET AJAX blog entries.
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter