How to disable the "Right Click" function of the mouse in web page?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How to disable the "Right Click" function of the mouse in web page?

Hybrid View

  1. #1
    shatin88 Guest

    How to disable the "Right Click" function of the mouse in web page?


    How to disable the "Right Click" function of the mouse in web page?
    Using Javascript? Any suggestion code?

  2. #2
    sodajerk Guest

    Re: How to disable the "Right Click" function of the mouse in web page?


    "shatin88" <shatin88@yahoo.com> wrote:
    >
    >How to disable the "Right Click" function of the mouse in web page?
    >Using Javascript? Any suggestion code?


    I dug this code up a couple of days ago. Hope it helps.

    document.oncontextmenu = function(){return false}
    if(document.layers) {
    window.captureEvents(Event.MOUSEDOWN);
    window.onmousedown = function(e){
    if(e.target==document)return false;
    }
    }
    else {
    document.onmousedown = function(){return false}
    }

  3. #3
    shatin88 Guest

    Re: How to disable the "Right Click" function of the mouse in web page?


    Your code is work!! Thks a lot!!

    "sodajerk" <whatsamattau@bigfoot.com> wrote:
    >
    >"shatin88" <shatin88@yahoo.com> wrote:
    >>
    >>How to disable the "Right Click" function of the mouse in web page?
    >>Using Javascript? Any suggestion code?

    >
    >I dug this code up a couple of days ago. Hope it helps.
    >
    >document.oncontextmenu = function(){return false}
    >if(document.layers) {
    > window.captureEvents(Event.MOUSEDOWN);
    > window.onmousedown = function(e){
    > if(e.target==document)return false;
    > }
    >}
    >else {
    > document.onmousedown = function(){return false}
    >}



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center