javascript - Why does this event handler use "e = e || event"? -


Can anyone tell me what this line of code is:

  function (E) {E = E || accident; E.returnValue = false; return false; }   

e is the name parameter? If I change it to 'Myoparam' then will it work? What does e = e mean?

Where is the variable event (after = ) declared? e.returnValue?

This is all basic event management, although it is missing e.preventDefault () ...

To break it, when an event handler is removed:

  • Some browsers have a one for callback incident data Other browsers (mostly older IE) instead of window.event (which can only be used as a event < / Code> is accessed here , Which is risky, because there is no local variables on that name)

    Next, e = E || accident; A standard way to say is, "If the parameter was not passed, define whatever is after = ". In this situation, if the event parameter has not been passed, it looks for the global variable.

    e.returnValue is one of three ways to stop the event, so its default action. The other two are e.preventDefault & amp; Amp; E.preventDefault () (which is clearly absent from the code you posted), and return false;

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -