On 12/02/2008, artemy tregoubenko <[EMAIL PROTECTED]> wrote:
>
> I don't want to break keyboard navigation only because of IE problem.
>

mousedown and click are both non-keyboard events.

but click is only for left button.

This is true for IE (7 on WinXPSP2) and FF (2.0.0.1 on WinXPSP2).

Here is a script to show you...

<html>
<head>
<script type="text/javascript"
src="http://prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js";></script>
<script type="text/javascript">
function clicking(e)
  {
  $('clicker').update($('clicker').innerHTML + '<br />' +
    'You clicked with your ' +
    (Event.isLeftClick(e) ? 'Left' : '') +
    (Event.isRightClick(e) ? 'Right' : '') +
    (Event.isMiddleClick(e) ? 'Middle' : '') +
    ' button. Event.button = ' + e.button +
    ' and Event.which = ' + e.which
    );
  }
</script>
<title>Testing clicking</title>
</head>
<body>
<span id="clicker">Left, Right or Middle click me!</span>
<script type="text/javascript">
Event.observe(document.body, 'click', clicking);
</script>
</body>
</html>

Try left/right/middle clicking in IE and FF and then change 'click' to
'mousedown' and retest.

Hopefully that will show you what we mean.
> On Tue, 12 Feb 2008 03:45:22 +0300, tancurrom <[EMAIL PROTECTED]> wrote:
>
> >
> > I think its just because of the way JavaScript handles the click
> > event. Use the 'mousedown' event instead of the 'click' event and you
> > will get your results
> >
> > On Feb 11, 2:42 pm, "artemy tregoubenko" <[EMAIL PROTECTED]>
> > wrote:
> >> Hello,
> >>
> >> Event.isLeftClick() is told to differ left clicks from right and middle
> >> clicks. However when I run
> >> document.observe('click', function(event){ alert(event.isLeftClick()); })
> >> in IE and then left-click page, I see 'false' in alert. This starts
> >> working if you listen to 'mousedown' or 'mouseup' events, but I don't like
> >> this way out.
> >>
> >> I don't like it because 'click' event may be triggered by keyboard too,
> >> and it's not good to forbid people to use keyboard at your site. I had an
> >> idea to listen for both 'mousedown' and 'click' events, but didn't manage
> >> to differ keyboard and mouse clicks in handler to avoid doubleposts.
> >>
> >> Is it possible to fix isLeftClick? If not, is there some nice workaround
> >> for this situation?
> >>
> >> --
> >> arty (http://arty.name)
> > >
> >
>
>
>
> --
> arty ( http://arty.name )



-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

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

Reply via email to