Hi Iain,

On 3/19/07, iain duncan <[EMAIL PROTECTED]> wrote:
>
> Ok, I know I *should* be able to figure this out, but I'm confused.
> Anyone have an example of using connect to grab a rightclick event in
> firefox and suppress the firefox default? Does stopPropagation do
> this, and if so, how do I use that after connecting a callback to an
> element with signal?

Here's an example:

<html>

<head>
<title></title>
<script type="text/javascript" src="MochiKit/MochiKit.js"></script>
</head>

<script type="text/javascript">

connect(window, 'onload', function() {
    connect(document, 'onclick', doRightClick);
});

function doRightClick(e) {
    if (e.mouse().button.right) {
        // do your stuff here...

        // prevent the context menu:
        e.stop();
    }
}

</script>

<body>
    Hello
</body>

</html>


HTH,
Arnar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to