Js mouse click event

Source: Internet
Author: User
The left IE button is window. event. right-click button1 and choose window. event. in button2, the key is window. event. button4 has no button action window. event. the left button of button0Firefox is event. right-click "button0" and select "event. button... sy IE left click is window. event. right-click button = 1 and choose window. event. button = 2. The middle key is window. event. button = 4 No button action window. event. button = 0 the left button of Firefox is event. right-click button = 0 and select event. button = 2. The key is event. button = 1 no button Action event. button = 0 Opera 7.23/7.54 left mouse button is window. event. button = 1 no button action Window. event. right-click = 1 and Middle-click cannot get Opera 7.60/8.0 left mouse button is window. event. button = 0 no button action window. event. button = 0 right-click and Middle-click cannot be obtained. In addition, window is blocked by right-click. event. button = 3 ************************************* * *********************** Window. the event object represents the event state, such as the element that triggers the event object, the location and status of the mouse, and the key that is pressed. Window. event objects are valid only when an event occurs. Some Properties of Window. event only make sense for specific events. For example, the fromElement and toElement attributes only make sense for onmouseover and onmouseout events. If the mouse moves out of the window after an event is triggered, the returned value is-1, which is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. Event object attributes include: altKey, button, Member, clientX, clientY, ctrlKey, fromElement, keyCode, offsetX, offsetY, propertyName, returnValue, screenX, screenY, delimiter, srcElement, srcFilter, the following describes the attributes of toElement, type, x, and y: 1. altKey Description: checks the status of the alt key. Syntax: the possible value of event. altKey: When the alt key is pressed, the value is TRUE; otherwise, the value is FALSE. Read-only. 2. button Description: Check the pressed mouse key. Syntax: event. possible values of the button: 0 without buttons; 1 with the left button; 2 with the right button; 3 with the left and right keys; 4 with the middle key; 5 with the left and middle keys; 6. Right-click and 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 the event control of upper-layer elements is accepted. Syntax: event. cancelBubble [= cancelBubble] possible value: This is a readable and writable Boolean value. TRUE is not controlled by the upper-layer event. FALSE allows the event to be controlled by the upper-layer element. This is the default value. 4. clientX Description: returns the X coordinates of the mouse in the client area of the window. Syntax: event. clientX Note: This is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. 5. clientY Description: return the Y coordinate of the mouse in the client area of the window. Syntax: event. clientY Note: This is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. 6. ctrlKey Description: Check the ctrl key status. Syntax: the possible value of event. ctrlKey: When the ctrl key is pressed, the value is TRUE; otherwise, the value is FALSE. Read-only. 7. fromElement Description: the elements that the mouse leaves when the onmouseover and onmouseout events occur. See 18. toElement Syntax: event. fromElement Note: This is a read-only attribute. 8. keyCode Description: Check the internal code corresponding to the keyboard event. This attribute is used for onkeydown, onkeyup, and onkeypress events. Syntax: event. keyCode [= keyCode] possible value: This is a read/write value, can be any Unicode keyboard internal code. If no keyboard event is triggered, the value is 0. 9. offsetX Description: checks the horizontal coordinate syntax of the mouse position relative to the trigger event object: event. offsetX 10. offsetY Description: checks the vertical coordinate syntax of the mouse position relative to the trigger event object: event. offsetY 11. propertyName Description: sets or returns the name of a property that has changed to an element. Syntax: event. propertyName [= sProperty] possible value: sProperty is a string that specifies or returns the name of the attribute changed by the element that triggers the event. Note: This attribute can be read and written. No default value. You can use the onpropertychange event to obtain the value of propertyName. 12. returnValue Description: sets or checks the Value Syntax returned from the event: event. possible value of returnValue [= Boolean]: the value in the true event is returned. The default operation of the event on the false source object is canceled. 13. screenX Description: detects the horizontal position of the mouse relative to the user's screen. Syntax: event. screenX Note: This is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. 14. screenY Description: Check the vertical position of the mouse relative to the user's screen Syntax: event. screenY Note: This is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. 15. shiftKey Description: checks the status of the shift key. Syntax: the possible value of event. shiftKey: when the shift key is pressed, the value is TRUE; otherwise, the value is FALSE. Read-only. 16. srcElement Description: return the element of the trigger event. Read-only. For examples, see the beginning of this article. Syntax: event. srcElement 17. srcFilter Description: return the filter that triggers the onfilterchange event. Read-only. Syntax: event. srcFilter 18. toElement Description: the element that the mouse enters when the onmouseover and onmouseout events occur. See 7. fromElement Syntax: event. toElement Note: This is a read-only attribute. 19. type description: name of the returned event. Syntax: event. type annotation: return the event name without the "on" prefix. For example, the type returned by the onclick event is click read-only. 20. x Description: returns the x axis coordinate of the upper-level element of the position attribute relative to the css attribute. If there is no upper-level element with the position attribute in the css attribute, the BODY element is used as the reference object by default. Syntax: event. x Note: If the mouse moves out of the window after the event is triggered, the returned value is-1, which is a read-only attribute. This means that you can only use it to get the current position of the mouse, but you cannot use it to change the position of the mouse. 21. y Description: returns the y axis coordinate of the upper-level element of the position attribute relative to the css attribute. If there is no upper-level element with the position attribute in the css attribute, the BODY element is used as the reference object by default. Syntax: event. y

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.