By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,652 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,652 IT Pros & Developers. It's quick & easy.

event.keyCode

P: n/a
hi !!
I have the following problem :
Is there a function or a constant value to check if a keyCode is a key kile
"Shift", "Alt" or "F1".
I would like not to use this way :

if( window.event.keyCode != 9
&& window.event.keyCode != 16
&& window.event.keyCode != 17
&& window.event.keyCode != 18
&& window.event.keyCode != 20
)

matthias
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Matthias Kn÷chlein" <ma*****************@gmx.de> schreef in bericht
news:bj************@ID-167556.news.uni-berlin.de...
hi !!
I have the following problem :
Is there a function or a constant value to check if a keyCode is a key kile "Shift", "Alt" or "F1".


You can use event.shiftKey and event.altKey, but the F1 key should be
captured by keyCode.

BTW, Mozilla provides a mapping for the keys, so you could do something
like:

if (evt.keyCode == evt.DOM_VK_F1)
alert('F1 is pressed');
JW

Jul 20 '05 #2

P: n/a

"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> schrieb im Newsbeitrag
news:3f***********************@news.euronet.nl...

"Matthias Kn÷chlein" <ma*****************@gmx.de> schreef in bericht
news:bj************@ID-167556.news.uni-berlin.de...
hi !!
I have the following problem :
Is there a function or a constant value to check if a keyCode is a key

kile
"Shift", "Alt" or "F1".


You can use event.shiftKey and event.altKey, but the F1 key should be
captured by keyCode.

BTW, Mozilla provides a mapping for the keys, so you could do something
like:

if (evt.keyCode == evt.DOM_VK_F1)
alert('F1 is pressed');
JW

Thanx, so I have to proove for every single key ?
Jul 20 '05 #3

P: n/a

"Matthias Kn÷chlein" <ma*****************@gmx.de> schreef in bericht
news:bj************@ID-167556.news.uni-berlin.de...

Thanx, so I have to proove for every single key ?


Yes
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.