473,326 Members | 2,104 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,326 software developers and data experts.

Arrow keys won't trigger keypress

Why does the following code give the alert in IE when most keys are
pressed, but not when the arrow keys are pressed? Both types of keys
trigger it in Netscape, but IE won't acknowledge arrow keypresses.

Please post reply here, I really appreciate the help.
<SCRIPT>

function keyboardEventHandler()
{
alert("Got it!");
}

</SCRIPT>

<BODY>
<SCRIPT>
document.onkeypress=keyboardEventHandler
</SCRIPT>
</BODY
Aug 6 '05 #1
2 7366


Michael wrote:
Why does the following code give the alert in IE when most keys are
pressed, but not when the arrow keys are pressed? Both types of keys
trigger it in Netscape, but IE won't acknowledge arrow keypresses.


Check IE's documentation, it describes which keys trigger which events:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onkeypress.asp>
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onkeydown.asp>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 6 '05 #2
ASM
Michael wrote:
Why does the following code give the alert in IE when most keys are
pressed, but not when the arrow keys are pressed? Both types of keys
trigger it in Netscape, but IE won't acknowledge arrow keypresses.

Please post reply here, I really appreciate the help.


try with onkeydown
--
Stephane Moriaux et son [moins] vieux Mac
Aug 6 '05 #3

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

Similar topics

0
by: Paul Nathan | last post by:
While trying to write a simple game which uses the arrow keys, I noticed that under the subroutine that handles mybase.keydown, everytime I pressed any arrow keys, or in fact any of the 9 keys...
3
by: FredSP | last post by:
I have a client who wishes to use the Enter Key and/or Arrow Keys, as well as the Tab Key, to navigate between Fields in a Windows form. Is this possible using C# in Visual Studio 2000 ?
0
by: meicher | last post by:
Hi, I have an application with forms. Every form includes a VScrollBar and a HScrollBar. The ScrollBars allways get the arrow keys and start blinking ? How can I catch these key events ? KeyUp,...
7
by: Seash | last post by:
Hi friends , here is the sample code private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == 13) //enter { txtbox2.Focus(); }
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
11
by: Rlrcstr | last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger a KeyPress or KeyDown event. Thanks. Jerry
2
by: Phil Galey | last post by:
I have a Panel control docked on all sides on a form and the panel control contains a PictureBox. I'm using the KeyDown event of the form to respond to the and keys for resizing the image and the...
5
by: Rob | last post by:
If I use the following code: Private Sub Form1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) _ Handles MyBase.KeyDown Dim myKey As Integer myKey =...
2
by: Vincent | last post by:
Hi, I have a user control that needs to trap the arrow keys to move items around internally. However, using the arrow keys will move the focus to another control on the form hosting the user...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.