Javascript mouse event Summary

Source: Internet
Author: User

  Tutorial on helping customers (www.bkjia.com)Javascript mouse events are a huge family. There are eight common examples:

Mousedown: the mouse button is pressed.

Mouseup: the mouse button is released.

Click: click the mouse button.

Dbclick: the mouse button is pressed.

Contextmenu: Right-click the menu.

Mouseover: move the mouse over the target.

Mouseout: move the mouse over the target.

Mousemove: move the cursor above the target.

The mousedown event and the mouseup event can be said to be the time subdivision of the click event. The order is mousedown => mouseup => click. Therefore, a click event usually triggers several mouse events.

The mousedown event and the mouseup event can be said to be the time subdivision of the click event. The order is mousedown => mouseup => click. Therefore, a click event usually triggers several mouse events.

With them, we can do many things, but it is obviously not enough for high-level applications (such as games, therefore, the Click Event of the mouse event is further subdivided based on whether it is a left-click or right-click event. In DOM2.0, W3C uses the mouse event as an example, and the mouse event is parsed as a MouseEvent (we can use e. constructor = MouseEvent to determine whether it is a mouse event. Whether it is left-click or right-click is determined by a button attribute. The following is the W3C standard example:

0: Left click

1: press the middle key (if any)

2: Right-click

Of course, Microsoft will not compromise, because e. button was originally implemented by Microsoft, and the Web site uses e. which, but it is more complicated than Microsoft.

0: no key is pressed

1: Left click

2: Right-click

3: The left and right buttons are pressed at the same time.

4: press the middle key

5: both the left and middle buttons are pressed.

6: The key and right-click are both pressed

7: The three keys are simultaneously pressed.

  • 5 pages in total:
  • Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page

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.