Event indicates the Event status, such as the Event element, keyboard status, mouse position, and mouse button status. Once an Event occurs, an event object is generated. If you click a button, the corresponding Event object is generated in the browser memory. The event object is valid only when an event occurs .... SyntaxHighlighter. all ();
Event indicates the Event status, such as the Event element, keyboard status, mouse position, and mouse button status. Once an Event occurs, an event object is generated. If you click a button, the corresponding Event object is generated in the browser memory.
The event object is valid only when an event occurs.
Some Properties of the event only make sense for specific events. For example, the fromElement and toElement attributes only make sense for onmouseover and onmouseout events.
[Event attribute ]:
AltKey, button, Member, clientX, clientY, ctrlKey, fromElement, keyCode, offsetX, offsetY, propertyName, returnValue, screenX, screenY, delimiter, srcElement, srcFilter, toElement, type, x, y
--------------------------------------------------------------------------------
1. altKey
Description: checks the status of the alt key.
Syntax: event. altKey
Possible values:
When the alt key is pressed, the value is TRUE; otherwise, the value is FALSE. Read-only.
2. button
Description: checks the pressed mouse key.
Syntax: event. button
Possible values:
0 without buttons
1 left click
2. Right-click
3. Press the Left or Right key.
4. Press the intermediate key
5. Press the left and intermediate keys.
6. Right-click and select intermediate key.
7. Press all keys
This attribute is only used for onmousedown, onmouseup, and onmousemove events. For other events, 0 (such as onclick) is returned regardless of the mouse status ).
3. cancelBubble
Description: checks whether events of upper-layer elements are controlled.
Syntax:
Event. cancelBubble [= cancelBubble]
Possible values:
This is a read/write Boolean value:
TRUE is not controlled by the event of the parent layer.
FALSE allows the event to be controlled by the upper-layer element. This is the default value.
Example:
The following code snippet demonstrates how to cancel showSrc () triggered by event onclick on the upper-Layer Element (body) if the shift key is also pressed when you click onclick on the image () function.