key sequence question

F

Frank L.

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top