Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > determining letter or digit on keydown

Reply
Thread Tools

determining letter or digit on keydown

 
 
PJ6
Guest
Posts: n/a
 
      12-03-2005
I can probably do this by mapping out all the number and letter key codes...
but I was just wondering if there is a built-in JavaScript function that can
determinine if the key pressed in the keydown event is a letter or a digit.
Or, more specifically to my functional requirement, a key that will affect
the contents of an input of type text. So I guess that plus backspace and
delete.

TIA,
Paul


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      12-03-2005
PJ6 wrote on 03 dec 2005 in comp.lang.javascript:

> I can probably do this by mapping out all the number and letter key
> codes... but I was just wondering if there is a built-in JavaScript
> function that can determinine if the key pressed in the keydown event
> is a letter or a digit. Or, more specifically to my functional
> requirement, a key that will affect the contents of an input of type
> text. So I guess that plus backspace and delete.
>


You are not telling what you mean by "do this", but altering the
functionality of the ext input field risks the penalty of users becoming
frustrated and going runnu=ing to other sites.

If you must, play with

<input onkeypress='alert(event.keyCode)'>

and see the ascii output enacted.

Then try:

<input onkeypress='var e=event.keyCode;return (e>47)&&(e<59)'>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
 
PJ6
Guest
Posts: n/a
 
      12-03-2005
"Evertjan." <> wrote in message
news:Xns9721C3E8FD690eejj99@194.109.133.242...

> You are not telling what you mean by "do this",


The subject of the post, "determining letter or digit on keydown".

> but altering the
> functionality of the ext input field risks the penalty of users becoming
> frustrated and going runnu=ing to other sites.


You assume that I'm altering behavior apparent to the user and that I'm
working on a site that's selling something, neither of which is true.

> If you must, play with
>
> <input onkeypress='alert(event.keyCode)'>
>
> and see the ascii output enacted.


Yeah. That's what I specifically said that I could do but would rather
avoid.

Paul


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      12-03-2005
PJ6 wrote on 03 dec 2005 in comp.lang.javascript:

> "Evertjan." <> wrote in message
> news:Xns9721C3E8FD690eejj99@194.109.133.242...
>
>> You are not telling what you mean by "do this",

>
> The subject of the post, "determining letter or digit on keydown".
>
>> but altering the
>> functionality of the ext input field risks the penalty of users
>> becoming frustrated and going runnu=ing to other sites.

>
> You assume that I'm altering behavior apparent to the user and that
> I'm working on a site


What non-apparent function would you device?

that's selling something, neither of which is true.

I did not, but let it be.

>> If you must, play with
>>
>> <input onkeypress='alert(event.keyCode)'>
>>
>> and see the ascii output enacted.

>
> Yeah. That's what I specifically said that I could do but would rather
> avoid.


What would you avoid? Finding out the function yourself?

You skip my final solution:

I wrote:
> Then try:
>
> <input onkeypress='var e=event.keyCode;return (e>47)&&(e<59)'>


Is this not what you want?



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(8-bit binary to two digit bcd) or (8-bit binary to two digit seven segment) Fangs VHDL 3 10-26-2008 06:41 AM
letter be is inserted into numbers as digit group separator aa ASP General 19 01-29-2007 09:44 AM
Re: big letter -> small letter Andrew McNamara Python 2 07-06-2004 02:09 PM
big letter -> small letter vertigo Python 4 07-06-2004 07:23 AM
RE: big letter -> small letter Tony Meyer Python 0 07-06-2004 07:11 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57