title: Disable Scroll button click in Javascript
body: <p>Please help me to rectify the below code snippet, Right click disable is working fine ,but Middle button(Scroll button) Disable is not working.It shows the message but after clicking [ok] to alert box. It will open in new tab.And i am using Firefox browser Thank you</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function clickIE()
  {
      if (document.all) 
      {
          alert("Right click is disabled2");
          return false;
      }
  }
  function clickNS(e) 
  {  
      if(document.layers||(document.getElementById&amp;&amp;!document.all)) 
      {
          if (e.which==3)
          {
              alert("Right click is disabled1");
              e.preventDefault();            
              return false;
          }
          if(e.which==2)
          {
              alert("Right click is disabled3");
              e.preventDefault();
              return false;
          }
      }
  }
  if (document.layers)
  {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown=clickNS;
  }
  else
  {
      document.onmouseup=clickNS;document.oncontextmenu=clickIE;
  }
      document.oncontextmenu=new Function("return false")</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="#"&gt;Hello world&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>