The Keypress event is triggered when a character is entered into a document.
It does not represent the press of a key on the keyboard. The keydown represents
the pressing of a key on the keyboard, and the keyup represents the release
of a key on the keyboard. These events represent the character entered by it's
keyboard key code, while the key press represents it by the code of the
generated character.
Form Elements Keypress (ALT+KEY)
'
--------------------------------------------------------------------------------
Firefox..: e.keyCode
Explorer.: event.keyCode
// if IE, make e window.event like firefox
if(document.all|window.event) e = window.event
--------------------------------------------------------------------------------
Code Example
function app_onkey(e) {
if(document.all) { //(window.event) firefox uses "e" already...
e = window.event
}
//alert(e.keyCode); return(0)
var key = e.keyCode
var ALT = e.altKey
var CTRL = e.ctrlKey
if(ALT)
return(altkey(e))
var kA = 65
var kD = 68
var kG = 71
var kS = 83
if(key==kA) return(xend())
if(key==kS) return(xbeg())
if(key==kD) return(xdef())
if(key==kG) return(xusr())
return(1)
} window.document.onkeyup = app_onkey
//window.document.onkeydown = app_onkey
//window.document.onerror = null
function altkey(e) {
var key = e.keyCode
var k1 = 49
var kk = APP_PARA_K2.split(',')
for(var i=0;i