Prev: FAQ Topic - How do I format a Number as a String with exactly 2 decimal places? (2010-05-27)
Next: Internet Explorer Compatibility Views
From: Rob Christiansen on 26 May 2010 19:39 When i press a key on the keyboard, the function returns the ASCII equivalent. That is the function i'm looking for. Can you give me a hint??? All i have so far is charCodeAt, but that's only good for already established strings. crazyswede *** Sent via Developersdex http://www.developersdex.com ***
From: nick on 26 May 2010 20:05 On May 26, 7:39 pm, Rob Christiansen <robb_christian...(a)q.com> wrote: > When i press a key on the keyboard, the function returns the ASCII > equivalent. That is the function i'm looking for. Unicode, not ASCII (although the keys you're pressing probably have the same value in Unicode as the do in ASCII). > Can you give me a hint??? All i have so far is charCodeAt, but that's > only good for already established strings. myChar = String.fromCharCode(myInt);
From: Stefan Weiss on 26 May 2010 20:42 On 27/05/10 01:39, Rob Christiansen wrote: > When i press a key on the keyboard, the function returns the ASCII > equivalent. That is the function i'm looking for. If you just need the keycodes for "normal" keys like letters, take a look at this simple example: document.onkeydown = function (evt) { var evt = evt || window.event; alert(evt.keyCode); }; There are some browser and platform oddities where special keys and key combinations are involved. For the specifics, search the web for "onkeydown" and "onkeypress". In a few minutes, you'll probably also get a link to an article named "K is for Keyboard" ;) -- stefan
From: David Mark on 26 May 2010 20:47 On May 26, 8:42 pm, Stefan Weiss <krewech...(a)gmail.com> wrote: > On 27/05/10 01:39, Rob Christiansen wrote: > > > When i press a key on the keyboard, the function returns the ASCII > > equivalent. That is the function i'm looking for. > > If you just need the keycodes for "normal" keys like letters, take a > look at this simple example: > > document.onkeydown = function (evt) { > var evt = evt || window.event; > alert(evt.keyCode); > }; > > There are some browser and platform oddities where special keys and key > combinations are involved. For the specifics, search the web for > "onkeydown" and "onkeypress". > In a few minutes, you'll probably also get a link to an article named "K > is for Keyboard" ;) > Why didn't you go ahead and post it? :) http://www.cinsoft.net/keyboard.html
From: Stefan Weiss on 26 May 2010 21:10
On 27/05/10 02:47, David Mark wrote: > On May 26, 8:42 pm, Stefan Weiss <krewech...(a)gmail.com> wrote: >> In a few minutes, you'll probably also get a link to an article named "K >> is for Keyboard" ;) > > Why didn't you go ahead and post it? :) > > http://www.cinsoft.net/keyboard.html Just wanted to demonstrate my psychic abilities :) -- stefan |