You are here: irt.org | FAQ | JavaScript | Event | Q848 [ previous next ]
In Netscape key presses are only captured when the cursor is within a text field:
<HEAD> <SCRIPT LANGUAGE="JavaScript1.2"><!-- function netscapeKeyPress(e) { alert(e.which + ' pressed'); } function microsoftKeyPress() { alert(window.event.keyCode + ' pressed'); } if (navigator.appName == 'Netscape') { window.captureEvents(Event.KEYPRESS); window.onKeyPress = netscapeKeyPress; } //--></SCRIPT> </HEAD> <BODY onKeyPress="microsoftKeyPress()"> <FORM> <TEXTAREA> </TEXTAREA> </BODY>