Полный пример
Полный пример
В этом примере window и document захватывают и освобождают события:
<HTML>
<SCRIPT>function fun1(e) {
alert ("The window got an event of type: " + e.type +
" and will call routeEvent.");
window.routeEvent(e);
alert ("The window returned from routeEvent.");
return true;
}function fun2(e) {
alert ("The document got an event of type: " + e.type);
return false;
}function setWindowCapture() {
window.captureEvents(Event.CLICK);
}function releaseWindowCapture() {
window.releaseEvents(Event.CLICK);
}function setDocCapture() {
document.captureEvents(Event.CLICK);
}function releaseDocCapture() {
document.releaseEvents(Event.CLICK);
}window.onclick=fun1;
document.onclick=fun2;</SCRIPT>
...
</HTML>