Window.captureEvents() (Function)

Part of the Netscape Navigator event propagation complex.

Availability:

JavaScript - 1.2
Netscape - 4.0
Deprecated:

JavaScript - 1.5
Netscape - 6.0
Property/method value type:undefined
JavaScript syntax:NcaptureEvents(anEventMask)
NmyWindow.captureEvents(anEventMask)
Argument list:anEventMaskA mask constructed with the manifest event constants

This is part of the event management suite which allow events to be routed to handlers other than just the one that defaults to being associated with an event.

The events to be captured are signified by setting bits in a mask.

This method allows you to specify what events are to be routed to the receiving window object.

The events are specified by using the bitwise OR operator to combine the required event mask constants into a mask that defines the events you want to capture. Refer to the Event Type Constants topic for a list of the event mask values.

A limitation of this technique is that, ultimately, only 32 different kinds of events can be combined in this way and this may limit the number of events the browser can support. If you need to build complex event handling systems in Netscape Navigator 4.x, you will have implement scripts using this technique. A different script will be required for MSIE.

You may be able to factor your event handler so that you only have to make platform specific event dispatchers and can call common handling routines that can be shared between MSIE and Netscape Navigator.

This method is supported by virtually every object by virtue of the fact that it is available as a method of the Global object in Netscape Navigator. Therefore it gets inherited into the scope chain for every script and function (method).

Warnings:

Example code:

   // Build and setup a mask for several events
   myEventMask = Event.KEYDOWN | Event.MOUSEDOWN | Event.RESET;
   window.captureEvents(myEventMask);
   function EventHandler(anEventObject)
   {
   //... some event handling code here
   }
   window.onkeydown   = EventHandler;
   window.onmousedown = EventHandler;
   window.onreset     = EventHandler;

See also:captureEvents(), Document.captureEvents(), Element.onevent, Event propagation, Event type constants, Frame object, Layer.captureEvents(), onMouseMove, Window object, Window.releaseEvents()