I am struggling with a Java applet on my webpage that allows users to edit text. Whenever a user tries to modify the text by pressing the backspace button, the browser mistakenly forwards to the previous page. I attempted to filter out the backspace key press using the following code snippet:
var a = function () {
var event = window.event;
if (event.keyCode == 8){
alert('backspace');
return false;
}
}
document.onkeydown = a;
While this solution prevents the backspace action from reaching the applet and modifying the text, it also stops the propagation of the event altogether. My question is: How can I successfully pass the event to the applet without further propagation?