JSsetCapture event capturing outside the region _ javascript skills

Source: Internet
Author: User
SetCapture is used to capture mouse events to the specified objects in the current document. This object receives all mouse events for the current application or the entire system. However, setCapture does not support Keyboard Events. Only the following mouse events can be captured: onmousedown, onmouseup, onmousemove, onclick, ondblclick, onmouseover, and onmouseout.
The program mainly needs to capture onmousemove and onmouseup events.
In the msdn introduction, it is also said that setCapture has a bool parameter to set whether all mouse events in the container are captured by the container.
When the parameter is true (default), the container will capture the mouse events of all objects in the container, that is, the objects in the container will not trigger the mouse events (the same as the objects outside the container );
When the parameter is set to false, the container does not capture the mouse events of objects in the container. That is, objects in the container can trigger events normally and cancel bubbles.
Object. setCapture () when an object is setCapture, its methods will be inherited to the entire document for capture. Objects. releaseCapture () must be used to release methods that do not need to inherit from the entire document for capturing.
Mozilla also has similar functions, with slightly different methods
Window. captureEvents (Event. eventType)
Window. releaseEvents (Event. eventType)
Example:

The Code is as follows:




Click the IE menu or button to see it :)
Or outside the IE window


Related Article

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.