473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Catch Ctrl+Alt+<letter>

Hi,

Question about
event.altKey
event.ctrlKey
event.shiftKey
If I need to catch when a user does say Ctrl+Alt+G -
somehow event.altKey is not working, i.e.:
a) I press Shift+K and this works:
if (evt.shiftKey)
{
alert("************** Shift");
....
}

b) I press Ctrl+K and this works:

if (evt.ctrlKey)
{
alert("************* Ctrl");
.........
}

c) But when I press Ctrl+Alt+K - nothing:

if (evt.ctrlKey && evt.altKey )
{
alert("****************** CTRL+Alt");
...
}
Anyone knows why?
--
Regards,
Paul
Jul 23 '05 #1
6 2941
Paul Gorodyansky wrote:
c) But when I press Ctrl+Alt+K - nothing:

if (evt.ctrlKey && evt.altKey )
{
alert("****************** CTRL+Alt");
...
}
Anyone knows why?


Be shure to attach it to an onkeydown event.
JW

Jul 23 '05 #2
Janwillem Borleffs wrote:

Paul Gorodyansky wrote:
c) But when I press Ctrl+Alt+K - nothing:

if (evt.ctrlKey && evt.altKey )
{
alert("****************** CTRL+Alt");
...
}
Anyone knows why?


Be shure to attach it to an onkeydown event.


It is attached to onkeypress event. Does it matter?

I wrote a code based on the example by Martin Honnen -
http://www.faqts.com/knowledge_base/view.phtml/aid/1661

So I have
<textarea ... onkeypress='return changeKey(this, event, fName)'>

and in that changeKey() function I am trying to use
Ctrl+Alt+letter thing

Again, I can catch event.ctrlKey and event.shiftKey but not

event.altkey
and not
(event.ctrlKey && event.altkey)

--
Regards,
Paul
Jul 23 '05 #3
Paul Gorodyansky wrote:
It is attached to onkeypress event. Does it matter?

Yes it does, attach it to the onkeydown event as I said before.
Again, I can catch event.ctrlKey and event.shiftKey but not

event.altkey


It's not "event.altkey" but "event.altKey".
JW

Jul 23 '05 #4
Janwillem Borleffs wrote:

Paul Gorodyansky wrote:
It is attached to onkeypress event. Does it matter?


Yes it does, attach it to the onkeydown event as I said before.
Again, I can catch event.ctrlKey and event.shiftKey but not

event.altkey


It's not "event.altkey" but "event.altKey".

JW


Hi,

I was a typo _here_, not in the code - in the code it's correct

Thanks,
Paul
Jul 23 '05 #5
Anyone?
--
Regards
Paul
Jul 23 '05 #6
Paul wrote:
Anyone?


Yes.
PointedEars
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.