Review
The event object contains three aspects of information. Look back on a piece of content!
The properties and methods in the event object, mainly information about the mouse and keyboard.
1. Get Event Type
Event object property Type
2. Get Key code
Event object Property KeyCode: Carriage return is 13, space is 32, back key is 8
3. Detect the SHIFT, ALT, CTRL key
Whether the event object properties are pressed: Shiftkey, Altkey, Ctrlkey
4. Get client coordinates
Event Object Properties Clientx and Clienty
5. Get screen coordinates
Event Object Properties Screenx and Screeny
Type of Event
The events that occur in the browser can be grouped into several types, depending on the object that triggered the event and the event that occurred:
One, mouse events
Each mouse event fills in values for the properties of the following event object:
1. Coordinate properties (e.g. clientx and client, etc.)
2.Type Properties
3.Targer (DOM) or Serelement (IE) Properties (target object properties)
4.shiftKey, Ctrlkey, Altkey, and Metakey (DOM) Properties
5.button property (only in the mouse event)
(Oevent.target | | oevent.srcelement). When the ID logical character or operator acts on two objects, the first object is Non-null, returns the first object, or returns the second object, which represents the ID of the element that caused the event.
Second, keyboard events
Keydown---Occurs when a key is pressed on the keyboard. Keep pressing a key, it will continue to trigger.
Keypress---Press a key and produce a character (that is, a key like shit ctrl ALT). It will continue to occur when the key is pressed.
Occurs when a pressed key is Keyup---released
1. Properties of the event
For each keyboard event, the following event properties are filled in:
KeyCode attribute (ASC code value for key)
CharCode property (DOM only)
Target (DOM) and Srcelement (IE) Properties
Shiftkey, Ctrlkey, Altkey, and Metakey (DOM) Properties
2. Order
When the user presses a character key one time, the event occurs in the following order:
(1), KeyDown;
(2), KeyPress;
(3), KeyUp;
If a user presses a non character key, such as shift, the event occurs in the following order:
(1), KeyDown;
(2), KeyUp;
third, HTML events
OnLoad, unload, resize, scroll and other events.
Iv. Catastrophe Events
A subtree of a document or element element is added to delete a node, and no mainstream browser has implemented it yet.
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