A step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.
A C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.
This tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.
Creating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.
A list of keys and the JavaScript char codes they correspond to |
On Saturday, August 13th 2005 at 01:09 PM By Andrew Pociu (View Profile) ![]() ![]() ![]() ![]() (Rated 5 with 2 votes) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This table is especially useful for those who want to capture the key press event in the browser window. These are the char codes JavaScript uses, and the keys they bind to:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Current CommentsAt last - This must be about the only place on the web this exists
Many thanks Andrei
Jim
And What about Ctrl+Q , Ctrl+Z, Ctrl+S key codes?
Thanks, another Jim (Dimitris)
Looked over for this.. Thank you very much!!
John
3
Excellent. Useful.
Any possibility of posting where this comes from. Is there a Standard or Manual somewhere?
Very useful. You could add SpaceBar=32
Wonderful ! Really useful.
function getCharDesc(char_code)
{
switch(char_code)
{
case 8:return "backspace";
case 9:return "tab";
case 13:return "enter";
case 16:return "shift";
case 17:return "ctrl";
case 18:return "alt";
case 19:return "pause/break";
case 20:return "caps lock";
case 27:return "escape";
case 33:return "page up";
case 34:return "page down";
case 35:return "end";
case 36:return "home";
case 37:return "left arrow";
case 38:return "up arrow";
case 39:return "right arrow";
case 40:return "down arrow";
case 45:return "insert";
case 46:return "delete";
case 48:return "0";
case 49:return "1";
case 50:return "2";
case 51:return "3";
case 52:return "4";
case 53:return "5";
case 54:return "6";
case 55:return "7";
case 56:return "8";
case 57:return "9";
case 65:return "A";
case 66:return "B";
case 67:return "C";
case 68:return "D";
case 69:return "E";
case 70:return "F";
case 71:return "G";
case 72:return "H";
case 73:return "I";
case 74:return "J";
case 75:return "K";
case 76:return "L";
case 77:return "M";
case 78:return "N";
case 79:return "O";
case 80:return "P";
case 81:return "Q";
case 82:return "R";
case 83:return "S";
case 84:return "T";
case 85:return "U";
case 86:return "V";
case 87:return "W";
case 88:return "X";
case 89:return "Y";
case 90:return "Z";
case 91:return "left window key";
case 92:return "right window key";
case 93:return "select key";
case 96:return "numpad 0";
case 97:return "numpad 1";
case 98:return "numpad 2";
case 99:return "numpad 3";
case 100:return "numpad 4";
case 101:return "numpad 5";
case 102:return "numpad 6";
case 103:return "numpad 7";
case 104:return "numpad 8";
case 105:return "numpad 9";
case 106:return "multiply";
case 107:return "add";
case 109:return "subtract";
case 110:return "decimal point";
case 111:return "divide";
case 112:return "F1";
case 113:return "F2";
case 114:return "F3";
case 115:return "F4";
case 116:return "F5";
case 117:return "F6";
case 118:return "F7";
case 119:return "F8";
case 120:return "F9";
case 121:return "F10";
case 122:return "F11";
case 123:return "F12";
case 144:return "num lock";
case 145:return "scroll lock";
case 186:return "semi-colon";
case 187:return "equal sign";
case 188:return "comma";
case 189:return "dash";
case 190:return "period";
case 191:return "forward slash";
case 192:return "grave accent";
case 219:return "open bracket";
case 220:return "back slash";
case 221:return "close braket";
case 222:return "single quote";
}
}
Did I overlook print screen? Where is it?
I think you missed the lowercase letters. :)
I might be missing something, but this does not work in IE8
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Fri, 18 Sep 2009 15:58:59 UTC
"'keyCode' is null or not an object"
Nevermind, there was a naming issue. It's all working quite well. :)
This code for printting comma if we press dot in the numpad
<html>
<heaD>
<script language="javascript">
function keypress1 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=44 : e.keyCode=44); }
}
function keypress2 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=46 : e.keyCode=46); }
}
function keyDown(e){
if (!e){
e = event
}
var code=e.keyCode;
if(code==110)
return document.onkeypress=keypress1
else if(code=188)
{ document.onkeypress=keypress2 }
}
document.onkeydown = keyDown
</script>
</head>
<body>
<input type=text>
</body>
</html>
This code for printting comma if we press dot in the numpad
<html>
<heaD>
<script language="javascript">
function keypress1 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=44 : e.keyCode=44); }
}
function keypress2 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=46 : e.keyCode=46); }
}
function keyDown(e){
if (!e){
e = event
}
var code=e.keyCode;
if(code==110)
return document.onkeypress=keypress1
else if(code=188)
{ document.onkeypress=keypress2 }
}
document.onkeydown = keyDown
</script>
</head>
<body>
<input type=text>
</body>
</html>
Related Knowledge Base Articles
Related Source Code
Related Tutorials
JavaScript Job Search