Im trying to make a menu on a site that can be used by pushing keyboard buttons. I found a javascript function that i am using, but i have a problem. This is what my js looks like;
document.onkeyup = KeyCheck;
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 49:
document.Shipping.submit();
break;
case 97:
document.Shipping.submit();
break;
case 50:
document.Recieving.submit();
break;
case 98:
document.Recieving.submit();
break;
case 51:
document.Void.submit();
break;
case 99:
document.Void.submit();
break;
case 52:
document.Ticketing.submit();
break;
case 100:
document.Ticketing.submit();
break;
}
}
Now, I need to make it so when i select a text field, this doesnt apply. If i now type my button into the text field, just as text, it registers it as a button press. I need to do something like onfocus = "somehow make it so that function is negated", to my form
Tags: