TOC PREV NEXT INDEX

domref



window.captureEvents()


Registers the window to capture all events of the specified type.

Syntax

window.captureEvents(Event.eventType)
 

Parameters

eventType is a string with one of the following values:

Abort
 
Load
 
Blur
 
MouseDown
 
Click
 
MouseMove
 
Change
 
MouseOut
 
DblClick
 
MouseOver
 
DragDrop
 
MouseUp
 
Error
 
Move
 
Focus
 
Reset
 
KeyDown
 
Resize
 
KeyPress
 
Select
 
KeyUp
 
Submit
 

Unload
 

Example

<html>
 
<script>
 
function reg() {
 
  window.captureEvents(Event.CLICK);
 
  window.onclick = hit;
 
}
 

 
function hit() {
 
  alert('hit');
 
}
 
</script>
 

 
<body onload="reg();">
 
<button>test</button>
 
<div id="d">&nbsp;</div>
 
</body>
 
</html>
 

Notes

Events raised in the DOM by user activity (such as clicking buttons or shifting focus away from the current document) generally pass through the high-level window and document objects first before arriving at the object that initiated the event.

When you call the captureEvents() method on the window, events of the type you specify (for example, Event.CLICK) no longer pass through to "lower" objects in the hierarchy. In order for events to "bubble up" in the way that they normally do, you must call releaseEvents() on the window to keep it from trapping events.

Also note that the eventType parameter is case-insensitive, so you can also say, for example, window.releaseEvents(Event.KeyPress).

See also window.releaseEvents().

Specification

DOM Level 0. Not part of specification.
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX