Page 1 of 1

Javascript: Simple Question

Posted: Tue Jun 13, 2006 12:52 pm
by tecktalkcm0391
I have a code that is this:

Code: Select all

<body onkeyup="keyBoard(event.keyCode)">
And I want to be able to pick up the shift then wait for another key as long as its is held down.

So that in the JS code:

Code: Select all

function keyBoard(key)
{
    if ((key < 106) && (key > 95)) newkey(key - 96);
    if ((key < 58) && (key > 47)) newkey(key - 48);
    if ((key == 8) || (key == 46) || (key == 67)) clearDisplay();
    if (key == 13) calc();        // "newkey"
    if ((key == 110) || (key == 188) || (key == 190)) newkey(".");
    if ((key == 107) || (key == 187)) newkey("+"); //Add
    if ((key == 109) || (key == 189)) newkey("-"); //Subtract
    if ((key == 106) || (key == 191)) newkey("*"); //Multiply
    if (key == 111) newkey("/");   // "Divide" 
}
It would also multiply if Shift and 8 are both held down. Do you get what I am aiming for ? How would I do this?

Thanks!

Posted: Tue Jun 13, 2006 1:28 pm
by Weirdan

Posted: Tue Jun 13, 2006 5:00 pm
by pickle
A more descriptive subject would probably get you more answers ;)

Posted: Tue Jun 13, 2006 6:28 pm
by feyd
well just look at that.. we've got a thread about this already. viewtopic.php?t=37059

Posted: Wed Jun 14, 2006 12:34 am
by tecktalkcm0391
I don't get that, really I am getting better at PHP, yes I know I have to look more though, but I have no clue when it comes to Javascript. I am going to get a book on it soon. Is there any manuals out there? But, yeah so what are you telling me to look at on that page? Cause it looks like your printing something. I dunno. Thanks.

P.S. I am not thinking right cause I am tried. :cry: