JavaScript and client side scripting.
Moderator: General Moderators
tecktalkcm0391
DevNet Resident
Posts: 1030 Joined: Fri May 26, 2006 9:25 am
Location: Florida
Post
by tecktalkcm0391 » Tue Jun 13, 2006 12:52 pm
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!
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Tue Jun 13, 2006 1:28 pm
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Jun 13, 2006 5:00 pm
A more descriptive subject would probably get you more answers
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Jun 13, 2006 6:28 pm
well just look at that.. we've got a thread about this already.
viewtopic.php?t=37059
tecktalkcm0391
DevNet Resident
Posts: 1030 Joined: Fri May 26, 2006 9:25 am
Location: Florida
Post
by tecktalkcm0391 » Wed Jun 14, 2006 12:34 am
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.