Home > Web Front-end > JS Tutorial > body text

JS setCapture event capture outside the area_javascript skills

WBOY
Release: 2016-05-16 18:32:01
Original
1168 people have browsed it

However, setCapture does not support keyboard events and can only capture the following mouse events: onmousedown, onmouseup, onmousemove, onclick, ondblclick, onmouseover and onmouseout.
The main purpose of the program is to capture the onmousemove and onmouseup events.
The msdn introduction also mentioned that setCapture has a bool parameter, which is used to set whether all mouse events in the container are captured by the container.
When the parameter is true (default), the container will capture mouse events for all objects in the container, that is, objects within the container will not trigger mouse events (the same as objects outside the container);
When the parameter is false, the container will not Capture mouse events of objects within the container, that is, objects within the container can trigger events and cancel bubbling normally.
Object.setCapture() When an object is setCapture, its method will be inherited to the entire document for capture. When you do not need to inherit the method to capture the entire document, use object.releaseCapture() to release.
Mozilla also has a similar function, with a slightly different method
window.captureEvents(Event.eventType)
window. releaseEvents(Event.eventType)
 Example:

Copy code The code is as follows:

< ;HTML>

Click the menu or button of IE to take a look:)
Or somewhere outside the IE window





After calling setCapture(), it will be automatically released after capturing the event. If you continue to capture events, you need to execute setCaptuer() again in the called event.
Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template