473,414 Members | 1,626 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,414 software developers and data experts.

Problem with javascript keydown event

Hello friends,

I am facing a very strange problem with the Keydown() event.

I have a textbox on my page. When ever a key is down on the textbox, I am calling a javascript function to display the character.

Expand|Select|Wrap|Line Numbers
  1. function monitorKeys(event)
  2. {
  3.   alert(event.keyCode); //This is displaying 219 for [ (opening square bracket)
  4.   alert(String.fromCharCode(event.keyCode))// This is displaying a weird Unicode  character
  5. }
I know that the event.keyCode will return the Unicode number on IE, but how can I convert it back to the original character?

I sincerely appreciate your help on this.
Feb 13 '09 #1
3 3431
acoder
16,027 Expert Mod 8TB
Browsers have differences with respect to the key and character pressed during onkeypress/up/down. This link should cover most of them.
Feb 14 '09 #2
Thanks Acoder, the link is very informative.
Feb 14 '09 #3
acoder
16,027 Expert Mod 8TB
You're welcome. Glad you found it useful.
Feb 14 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mee-shell | last post by:
Hi, I am a python newbie. I have created a tool for capturing the screen shot. I want to be able to do the screen capture with the keydown event as well. The tool worked fine when it first...
34
by: Andrew DeFaria | last post by:
I thought this would be fairly straight forward but apparently it's not. Given the following html file: <!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <html> <head>...
0
by: Mike Burkhart | last post by:
I have written the following class to build a data grid textbox column that has the KeyUp and KeyPress events defined for the TextBox. I also defined the KeyDown event for testing purposes only. ...
1
by: fripper | last post by:
I have a VB 2005 windows app and I want to recognize keydown events. I have a form key down event handler but it does not get control when a key is depressed. In playing around I found that if I...
3
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
1
by: JDeats | last post by:
If you create a new C# Windows Application project in Visual Studio.NET 2003 or 2005 and proceed to. 1. Make default form size 800x600 2. Drop a CheckBoxList control and dock it to the left 3....
3
by: win | last post by:
when the cursor is in a textbox, only coding in the keydown event of the textbox triggered, the coding in the keydown event of the form does not triggered! Problem: I need to change a VB6 program...
1
by: Gouri.Mahajan7 | last post by:
Hello, I am loading the user control on the web page. In the user control i have added the key down event, when enter key is pressed i am displaying some message. When I run the user control...
1
by: jagwinderwalia | last post by:
Hi all i have build a autocomplete textbox control that works on keyup event in javascript. everytime a keyup is called , a request is send back to server and the suggestion are displayed in div...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.