event.keyCode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthias Knöchlein

    event.keyCode

    hi !!
    I have the following problem :
    Is there a function or a constant value to check if a keyCode is a key kile
    "Shift", "Alt" or "F1".
    I would like not to use this way :

    if( window.event.ke yCode != 9
    && window.event.ke yCode != 16
    && window.event.ke yCode != 17
    && window.event.ke yCode != 18
    && window.event.ke yCode != 20
    )

    matthias


  • Janwillem Borleffs

    #2
    Re: event.keyCode


    "Matthias Knöchlein" <matthias.knoec hlein@gmx.de> schreef in bericht
    news:bjmn02$k00 no$1@ID-167556.news.uni-berlin.de...[color=blue]
    > hi !!
    > I have the following problem :
    > Is there a function or a constant value to check if a keyCode is a key[/color]
    kile[color=blue]
    > "Shift", "Alt" or "F1".[/color]

    You can use event.shiftKey and event.altKey, but the F1 key should be
    captured by keyCode.

    BTW, Mozilla provides a mapping for the keys, so you could do something
    like:

    if (evt.keyCode == evt.DOM_VK_F1)
    alert('F1 is pressed');


    JW



    Comment

    • Matthias Knöchlein

      #3
      Re: event.keyCode


      "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> schrieb im Newsbeitrag
      news:3f5f0d04$0 $28904$1b62eedf @news.euronet.n l...[color=blue]
      >
      > "Matthias Knöchlein" <matthias.knoec hlein@gmx.de> schreef in bericht
      > news:bjmn02$k00 no$1@ID-167556.news.uni-berlin.de...[color=green]
      > > hi !!
      > > I have the following problem :
      > > Is there a function or a constant value to check if a keyCode is a key[/color]
      > kile[color=green]
      > > "Shift", "Alt" or "F1".[/color]
      >
      > You can use event.shiftKey and event.altKey, but the F1 key should be
      > captured by keyCode.
      >
      > BTW, Mozilla provides a mapping for the keys, so you could do something
      > like:
      >
      > if (evt.keyCode == evt.DOM_VK_F1)
      > alert('F1 is pressed');
      >
      >
      > JW
      >
      >
      >[/color]
      Thanx, so I have to proove for every single key ?


      Comment

      • Janwillem Borleffs

        #4
        Re: event.keyCode


        "Matthias Knöchlein" <matthias.knoec hlein@gmx.de> schreef in bericht
        news:bjn4j0$kt8 cj$1@ID-167556.news.uni-berlin.de...[color=blue][color=green]
        > >[/color]
        > Thanx, so I have to proove for every single key ?
        >
        >[/color]

        Yes


        Comment

        Working...