event.keyCode

Discussion in 'Javascript' started by Matthias Knöchlein, Sep 10, 2003.

  1. 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.keyCode != 9
    && window.event.keyCode != 16
    && window.event.keyCode != 17
    && window.event.keyCode != 18
    && window.event.keyCode != 20
    )

    matthias
    Matthias Knöchlein, Sep 10, 2003
    #1
    1. Advertising

  2. "Matthias Knöchlein" <> schreef in bericht
    news:bjmn02$k00no$-berlin.de...
    > 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".


    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
    Janwillem Borleffs, Sep 10, 2003
    #2
    1. Advertising

  3. "Janwillem Borleffs" <> schrieb im Newsbeitrag
    news:3f5f0d04$0$28904$...
    >
    > "Matthias Knöchlein" <> schreef in bericht
    > news:bjmn02$k00no$-berlin.de...
    > > 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".

    >
    > 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
    >
    >
    >

    Thanx, so I have to proove for every single key ?
    Matthias Knöchlein, Sep 10, 2003
    #3
  4. "Matthias Knöchlein" <> schreef in bericht
    news:bjn4j0$kt8cj$-berlin.de...
    > >

    > Thanx, so I have to proove for every single key ?
    >
    >


    Yes
    Janwillem Borleffs, Sep 10, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marvin Massih

    "Keycode DLL not found or invalid keycode"

    Marvin Massih, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,130
    Marvin Massih
    Dec 31, 2004
  2. Nathan Sokalski
    Replies:
    4
    Views:
    4,170
    Nathan Sokalski
    Mar 11, 2006
  3. Nathan Sokalski

    Determining the Browser and event.keyCode vs. event.which

    Nathan Sokalski, Mar 10, 2006, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    173
    Nathan Sokalski
    Mar 11, 2006
  4. yzzzzz

    Getting keycode from keypress event

    yzzzzz, Jul 13, 2003, in forum: Javascript
    Replies:
    3
    Views:
    93
    Grant Wagner
    Jul 14, 2003
  5. Matthew
    Replies:
    1
    Views:
    102
    Lasse Reichstein Nielsen
    Feb 10, 2004
Loading...

Share This Page