Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: right click detection
From: Eric Dunham
Date: Mon, 27 Dec 1999 04:25:18 GMT

To Kenneth and anyone else out there interested in right-click detection:

<rant>
Let me start this by saying, yes you can do this. What I can't stand is when
people only reply with a "Yes you can", and then do not offer a single bit
of advice on how to accomplish the task. Do the people that post these kind
of messages really think that that helps anyone? All it does is eat up
bandwidth and waste time, IMNSHO.
</rant>
<solution>
here is a simple script that you can use...
----------------------------------------------------
<!--
function RightClickCatcher(click){
if (document.layers && click.which == 3) {
alert('You right-clicked!');
return false;
}
if (document.all && event.button == 2) {
alert('You right-clicked!');
return false;
}
}
document.onmousedown = RightClickCatcher;
//-->
----------------------------------------------------
*NB: This script uses object detection versus browser detection, because
it's better that way :)
Further notes on the script: The 'alert()' statement may be replaced with
any other statement that you wish to execute, or you may take it out
altogether. The 'return false;' statement is there to prevent the normal
action that would occur as a result of the event. In other words, it stops
the right-click event from working. If you don't understand what I mean, try
putting the following text into an html document:
<a href="#" onclick="return false;">foo</a>
When you click on the link, it doesn't do anything, and that is because the
'return false;' statement prevents the normal action that would be carried
out by the object/event. Anyway, you may take that out as well if you wish
the normal action to be executed. Finally, the 'document.onmousedown' is the
event handler that calls the RightClickCatcher function. So basically when
there is a mousedown anywhere in the document, the function is called. You
may change this however you wish.
</solution>

Hope that helps,
Eric Dunham



flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streaming Media WEST '99 Conference & Exhibition
"The Worlds largest Internet Audio & Video Event"
December 7 - 9, San Jose Convention Center, California

Reserve your space today at http://www.streamingmedia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: right click detection, John Croteau

Replies
  FLASH: right click detection, Kenneth Austin

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]