Update Status On Right Click

[Total: 0    Average: 0/5]

This shows how to determine when the right mouse button is clicked, and to then issue a message to the window status telling the user a little message.

Head Code:

<script type=text/javascript>
var msg = "I see you right clicking on me!";
if(document.layers) window.captureEvents(Event.MOUSEDOWN);

function no_click(e){
  if (navigator.appName == 'Netscape' && ( e.which == 2 || e.which == 3)) {
    defaultStatus=msg;
  }
  if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
    defaultStatus=msg;
  }
}
window.onmousedown=no_click;
document.onmousedown=no_click;
</script>

Body Code:


Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *