JavaScript Events Object (Event object)

Source: Internet
Author: User
Tags event listener

Original: http://www.cnblogs.com/songyaqi/p/5204143.html

    • In the function that triggers the event, we receive an event object, through which we need some parameters, for example, if we need to know who the event is for, we can get it through the property of event target (ie aside), Or you can block the default behavior of the browser by means of a method preventDefault() . Here are some properties and methods of the event object
Properties Description
altkey
button
clientx
clienty
ctrlkey
metakey
relatedtarget
screenx
screeny
shiftkey
    • IEProperties (in addition to the mouse/event properties above, IE also supports the following properties)
Properties Description
cancelbubble
fromelement
keycode
offsetx,offsety
returnvalue If this property is set, its value is higher than the return value of the event handle. Set this property to
srcelement
toelement
x,y
    • The standard event attribute lists the properties defined by the Level 2 DOM event standard.
Properties and Methods Description
Bubbles Returns a Boolean value that indicates whether the event is a bubbling event type.
cancelable Returns a Boolean value that indicates whether the event can hold a default action that can be canceled.
currentTarget Returns the element whose event listener triggered the event.
Eventphase Returns the current stage of event propagation.
target Returns the element that triggered this event (the target node of the event).
TimeStamp Returns the date and time the event was generated.
type Returns the name of the event represented by the current event object.
Initevent () Initializes the properties of the newly created Event object.
preventDefault() Notifies the browser not to perform the default action associated with the event.
stopPropagation() No more events are being dispatched.

JavaScript Events Object (Event object)

Related Article

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.