You are here: irt.org | FAQ | JavaScript | Event | Q1593 [ previous next ]
Try:
<script language="JavaScript"><!--
var NS = (document.layers) ? 1 : 0;
var IE = (document.all) ? 1 : 0;
// if (NS) document.captureEvents(Event.KEYPRESS); // uncomment if you wish to cancel the key
document.onkeypress = keyhandler;
function keyhandler(e) {
if (NS) Key = e.which;
else Key = window.event.keyCode;
if (Key !=0) alert("Key pressed! ASCII-value: " + Key);
}
//--></script>