1function myKeyPress(e){
2 var keynum;
3
4 if(window.event) { // IE
5 keynum = e.keyCode;
6 } else if(e.which){ // Netscape/Firefox/Opera
7 keynum = e.which;
8 }
9
10 alert(String.fromCharCode(keynum));
11}