Disabling RightMouse click

Results 1 to 3 of 3

Thread: Disabling RightMouse click

  1. #1
    Join Date
    Dec 1969

    Default Disabling RightMouse click

    How can i disable rightmouse event on my text area in Netscape<BR><BR>function textarea_onmousedown {<BR>return false<BR>}<BR>work well in IE but not in Netscape <BR> any one have some clue?<BR>thanxs in advance

  2. #2
    Join Date
    Dec 1969

    Default Here you go...

    This will do the job. Enjoy!<BR><BR>&#060;script language="JavaScript1.2"&#062;<BR>//This should get you going in the right direction. <BR><BR>if (window.Event) // Only Netscape will have the CAPITAL E.<BR> document.captureEvents(Event.MOUSEUP); // catch the mouse up event<BR><BR>function nocontextmenu() // this function only applies to IE4, ignored otherwise.<BR>{<BR> event.cancelBubble = true<BR> event.returnValue = false;<BR><BR> return false;<BR>}<BR><BR>function norightclick(e) // This function is used by all others<BR>{<BR> if (window.Event) // again, IE or NAV?<BR> {<BR> if (e.which == 2 &#124&#124 e.which == 3)<BR> return false;<BR> }<BR> else<BR> if (event.button == 2 &#124&#124 event.button == 3)<BR> {<BR> event.cancelBubble = true<BR> event.returnValue = false;<BR> return false;<BR> }<BR> <BR>}<BR><BR>document.oncontextmenu = nocontextmenu; // for IE5+<BR>document.onmousedown = norightclick; // for all others<BR>&#060;/script&#062;

  3. #3
    j Guest

    Default RE: Disabling RightMouse click

    why do you want to do it? the right mouse button is as essential as a back button. oh well.<BR><BR>element.onmouseup = function disable() {<BR> var whichbutton=(document.all?window.event.button:even t.which;<BR> if(whichbutton==3){return false;}<BR>}<BR>if(document.all){<BR>window.captur eEvents(Event.MOUSEUP)<BR>}<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts