Disabling Right Clickmethod of checking which of the mouse buttons was pressed is different in the two cases. For Netscape Navigator, we check e.which to be equal to 2 or 3. This attribute of event object tells us the button that was pressed - button 2 or 3. For IE, we use event.button to check which button was pressed. We return false in both the cases to tell the browser that we have handled the event correctly. The last part of the scipt is registration of our functino with the browser. document.onmousedown can be set equal to captureRightClick() to do that.
The copyright of the article Disabling Right Click in JavaScript is owned by Muhammad Ali Shah. Permission to republish Disabling Right Click in print or online must be granted by the author in writing.
Go To Page: 1 2 Articles in this Topic Discussions in this Topic |