SoFunction
Updated on 2025-02-28

Memos for Javascript event capture (setCapture,captureEvents)

During this period, I have been studying the problem of Js drag and drop for QZone. The module I suddenly discovered today can actually step out of the browser by dragging and dropping it. What exactly is the method to make the mousemove and mouseup events go outside the browser or trigger, so the entire live js down was analyzed, and it turned out that it was a small function that was doing "monster".

() When an object is setCapture, its method will be inherited to the entire document for capture.
When there is no need to inherit the method to the entire document capture, use ()

Mozilla also has similar functions, the methods are slightly different
  () 
   ()

Event is a special object of Mozilla.
eventTypes include: Abort, Blur, Click, Change, DblClick, DragDrop, Error, Focus, KeyDown, KeyPress, KeyUp, Load, MouseDown
The following example is lazy and does not make Mozilla compatibility, just for demonstration

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Related connections:
For IE
/library/?url=/workshop/author/dhtml/reference/methods/
/library/?url=/workshop/author/dhtml/reference/methods/

For Mozilla
/en/docs/DOM:
/en/docs/DOM: