capture event when ctrl key is pressed

M

Mr. x

Hello,
I want to capture the event when the <ctrl> key is pressed.

How can I do that ?

Thanks :)
 
M

Michael Winter

on 14/11/2003:
Hello,
I want to capture the event when the <ctrl> key is pressed.

How can I do that ?

This is under IE 6 (I don't have any other browsers, so someone else
will have to chip in).

A onkeydown event is fired when the CTRL key is pressed, but the
event.which and event.modifiers properties are undefined (even when a
letter key is pressed). This means that there is no reliable way to
detect it. The onkeypress event doesn't work with modifier keys
(ctrl, alt, shift, etc).

Do Mac keyboards even have CTRL keys?

Mike
 
F

Fabian

Michael Winter hu kiteb:
on 14/11/2003:


This is under IE 6 (I don't have any other browsers, so someone else
will have to chip in).

A onkeydown event is fired when the CTRL key is pressed, but the
event.which and event.modifiers properties are undefined (even when a
letter key is pressed). This means that there is no reliable way to
detect it. The onkeypress event doesn't work with modifier keys
(ctrl, alt, shift, etc).

Both navigator 7 and explorer 6 can detect the onkeyup event, and do
recognise the control key. onkeydown and onkeypress may also be
supported. However, control+[key] combo keystrokes are rather more
difficult to detect. I haven't tried.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top