key sequence question

Discussion in 'Javascript' started by Frank L., Jul 10, 2003.

  1. Frank L.

    Frank L. Guest

    Hi. I have this key sequence detection:

    keySeq = 0

    function keyHandler() {

    switch (event.keyCode) {
    case 78:
    if (keySeq==0) {keySeq++}
    break
    case 65:
    if (keySeq==1) {keySeq++}
    keySeq = 2
    break
    case 82:
    if (keySeq==2) {keySeq++}
    keySeq = 2
    break
    case 85:
    if (keySeq==2)
    alert("Hello")
    keySeq = 0
    }
    }


    Is there a way I could put in an 'if' statement so I could say basically "if
    this sequence of keys is pressed, do this action, else if do something else,
    else if....etc, etc.

    Thanks
    Frank
    Frank L., Jul 10, 2003
    #1
    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. Christian Bongiorno

    custom key and hasmap using a ranged key

    Christian Bongiorno, Jun 15, 2004, in forum: Java
    Replies:
    1
    Views:
    446
    Roedy Green
    Jun 15, 2004
  2. stef mientki
    Replies:
    13
    Views:
    618
    stef mientki
    Oct 20, 2007
  3. XML fellow
    Replies:
    2
    Views:
    413
    XML fellow
    Oct 3, 2008
  4. M P
    Replies:
    1
    Views:
    454
  5. Ronnie Bermejo
    Replies:
    1
    Views:
    131
Loading...

Share This Page