Thanks again, it works with NN 7.
But i still can click on the menu and other buttons of the browser. Is it
not possible to make this impossible?
Dave
"Martin Honnen" <Martin.Honnen@t-online.de> schreef in bericht
news:3F44F697.9050905@t-online.de...[color=blue]
>
>
> Dave wrote:[color=green]
> > Hi,
> >
> > With this code, I thought that any 'click' with the mouse would be[/color][/color]
captured[color=blue][color=green]
> > on the window level and nothing would happen, but a click on the button
> > triggers nevertheless the function hit(). Why is it not directed to the
> > function IgnoreEvents instead of the function hit?
> > ...
> > <script>
> > window.top.captureEvents(Event.CLICK)
> > window.top.onclick=IgnoreEvents
> >
> > function IgnoreEvents(e)
> > { return false }
> >
> > function hit()
> > { alert('hit') }
> > </script>
> >
> > INPUT TYPE="button" onClick="hit()"
> > ...
> >
> > Thanks for your explanation[/color]
>
> captureEvents is part of the NN4 event model, and with NN4 I am sure you
> can click the button as much as you want, it doesn't fire its onclick
> handler:
>
> <html>
> <head>
> <title>NN4 captureEvents</title>
> <script type="text/javascript">
> if (document.layers) {
> window.captureEvents(Event.CLICK);
> window.onclick = function (evt) {
> return false;
> }
> }
> </script>
> </head>
> <body>
> <form>
> <input type="button" value="button"
> onclick="alert(event.type);">
> </form>
> </body>
> </html>
>
> I guess you are trying with Netscape 6/7 or Mozilla which unfortunately
> has window.captureEvents as a function in its browser object model but
> this doesn't do anything.
> If you want to capture events with Netscape 6/7 or Mozilla use
> window.addEventListener('eventname', eventHandler, true)
> as in
>
> <html>
> <head>
> <title>NN4 captureEvents</title>
> <script type="text/javascript">
> if (document.layers) {
> window.captureEvents(Event.CLICK);
> window.onclick = function (evt) {
> return false;
> }
> }
> else if (window.addEventListener) {
> window.addEventListener('click',
> function (evt) {
> if (evt.stopPropagation) {
> evt.stopPropagation();
> return false;
> }
> },
> true
> );
> }
> </script>
> </head>
> <body>
> <form>
> <input type="button" value="button"
> onclick="alert(event.type);">
> </form>
> </body>
> </html>
>
> --
>
> Martin Honnen
>
http://JavaScript.FAQTs.com/
>[/color]