JS judgment by mouse and buttons

Source: Internet
Author: User

the mouse button is determined in Js.
ie
left click window . event . button = 1
right-click window . event . button = 2
window . event . button = 4
no buttons window . event . button = 0

firefox
the left button is event . button = 0
right-click event . button = 2
the key is event . button = 1
no button action event . button = 0

opera 7.23/7.54
the left mouse button is window . event . button = 1
no buttons window . event . button = 1
the right-click and Middle-click buttons cannot be obtained.

Opera 7.60/8.0
The left mouse button isWindow.Event.Button = 0
No button actionWindow.Event.Button = 0
Right-click and Middle-click cannot be obtained

In addition, the right-click blocking isWindow.Event.Button = 3

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.