Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Right Click Event


Message #1 by Terrence Joubert <Terrence@v...> on Tue, 2 Apr 2002 11:50:53 +0400
This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C28277.B8846A40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

this code is useful for you

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
hello world
<script language=3DJavaScript>
var message=3D"Sorry bud, no right-clicking allowed!";

function clickIE()
{
 if (document.all)
 {
  alert(message);
  return false;
 }
}
function clickNS(e)
{
 if (document.layers||(document.getElementById&&!document.all))
 {
  if (e.which=3D=3D2||e.which=3D=3D3)
   {
    alert(message);
    return false;
   }
 }
}

 if (document.layers)
 {
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown=3DclickNS;
 }
 else
 {
  document.onmouseup=3DclickNS;
  document.oncontextmenu=3DclickIE;
 }

// document.oncontextmenu=3Dnew Function("return false")

</script>

</BODY>
</HTML>

  ----- Original Message -----
  From: Terrence Joubert
  To: JavaScript HowTo
  Sent: Tuesday, April 02, 2002 1:20 PM
  Subject: [javascript_howto] Right Click Event


  Hi,

  

  Would anyone know whether there is an event that is triggered when the 
user right click on a web page. If yes, would you have any idea of how I 
can catch this event so as to implement a handler?

  

  Thanks

  Terrence

  

  --- Improve your web design skills with these new books from 
Glasshaus. Usable Web Menus 
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e r-20 Constructing Accessible Web Sites 
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e r-20 Practical JavaScript for the Usable Web 
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e r-20 ---




  Return to Index