Parameter descriptions for DOM element binding events

Source: Internet
Author: User
When event handling that is bound on a DOM element is written in a label, there are two known constants whose names are occupied, respectively:
Event: Represents the Events object, this: represents the element itself
Note: If the calling script method needs to use both objects, it must be passed in as a parameter

When event handling that is bound on a DOM element is not written in a tag, it is purely script bound, then:
Script Method 1th parameter: Automatically represents an Event object, this: automatically represents the element itself
Note: The 1th parameter name of the script method, whether it is write event, or X, or a, is represented as an event object,
If there is no write parameter name, you can also get the event object by Arguments[0].

In both cases, the formal parameters of the script method have a special case:
If the script method does not write the event parameter, but the method inside refers to the event variable, it can represent the properties of the Window object under IE, Firefox does not know the variable, and chrome will still be considered an event object. (if the parameter uses the event name, then the name can only be used as a formal parameter, and will not be recognized as a window property under IE)

Parameter descriptions for DOM element binding events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.