Javascript: keyCode versus charCode

July 26, 2009 at 11:35 pm Leave a comment

Javascript key press events have both a keyCode and a charCode property. These are mutually exclusive – whenever one is non-zero the other is zero.

Which one is set depends on the type of event: keydown and keyup events give one events with keyCode set (they produce corresponding character) whilst keypress events give one events with charCode set.

Advertisements

Entry filed under: Uncategorized. Tags: , .

Automatically loading a truecrypt share at startup Why might a set API be useful

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


July 2009
M T W T F S S
« May   Aug »
 12345
6789101112
13141516171819
20212223242526
2728293031  

%d bloggers like this: