this is sort of a javascript question, but its on my jsp pages so i'll ask. ;)
I would like to be able to disable the backspace key so that
a user cannot hit it to travel back a page. However, i want to leave
it enabled so that they can at least backspace while in form text elements and text areas, etc.
i have this bit of code (see bottom) that will capture the backspace, but it turns it off even for the text elements in a form.
the good news is that its for an intranet application and we are
only going to be supporting IE 5.5 or better, so it doesn't have to be cross browser compatible
thanks,
ken
<script language="JavaScript"><!--
document.onkeydown = mykeyhandler;
function mykeyhandler() {
if (window.event && window.event.keyCode == 8) {
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
//--></script>