🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: microsoft.public.inetsdk.programming.scripting.jscript
Article #12

Re: event handler for right mouse button in JS, possible?

#12
From: Rafael Rasinger
Date: Thu, 30 Sep 1999 00:00
62 lines
2845 bytes
Hi Martin!

> Yes, you just use one event handler for the document or window object
> and then check which button was pressed for instance

Thanx a lot! U helped me a lot!

Sorry for asking a lot, but I am kind of new in the JS business.

Just 2 last questions:
1) How can I rewrite the script to enable the rightmouse click function only
when rightclicking a button or <a href>?

2) When I use
"window.open("tt.html","HELP","height=90,width=110,status=no,scrollbars=no")
;" instead of "alert("...")" (see code below) I get the new window and the
context menu in MSIE5, but I only want the window. Is there a way? In NN it
works.

Thanx a lot!


************************

if (document.layers)
    document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown =
    function Clique(evt) {
      if ((document.layers && evt.which == 3) || (document.all &&
event.button == 2))
      {

window.open("tt.html","HELP","height=90,width=110,status=no,scrollbars=no");
       return false;
      }
      else alert("left");
    };
*******************************

>  if (document.layers)
>     document.captureEvents(Event.MOUSEDOWN);
>   document.onmousedown =
>     function (evt) {
>       if ((document.layers && evt.which == 3) || (document.all &&
> event.button == 2)) {
>        alert('right mouse button');
>        return true;  // use false here to cancel menu in nn
>       }
>     };
>
> Rafael Rasinger wrote:
> >
> > Dear reader!
> >
> > I am looking for the posibilty to uo use these JS-event handlers, but
for
> > the RIGHT mouse button. Is there a way to do it?
> >
> > Thank you!
> >
> >  Rafael
>
Technical Details
Message-ID: <37f33e78@news.kapsch.co.at>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37f1c30a@news.kapsch.co.at> <37F226FD.DB41DA3D@sector27.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d4a5,ac438531d738d94e
X-Google-Attributes: gid10d4a5,public
X-Google-Thread: 10731d,ac438531d738d94e
X-Google-Attributes: gid10731d,public
X-Google-Thread: fcc66,ac438531d738d94e
X-Google-Attributes: gidfcc66,public
X-Google-Thread: 10c71c,ac438531d738d94e
X-Google-Attributes: gid10c71c,public
X-Google-Thread: fb3cb,ac438531d738d94e
X-Google-Attributes: gidfb3cb,public
From: "Rafael Rasinger" <rasinger@atc.co.at>
Subject: Re: event handler for right mouse button in JS, possible?
Date: 1999/09/30
Message-ID: <37f33e78@news.kapsch.co.at>
X-Deja-AN: 531077448
References: <37f1c30a@news.kapsch.co.at> <37F226FD.DB41DA3D@sector27.de>
X-Original-NNTP-Posting-Host: 193.80.86.140
X-Trace: 30 Sep 1999 12:42:00 +0100, 193.80.86.140
Organization: Kapsch AG; Vienna, Austria
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: microsoft.public.inetsdk.programming.scripting.jscript,microsoft.public.scripting.jscript,borland.public.intrabuilder.javascript,comp.lang.javascript,de.comp.lang.javascript
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@kapsch.net