Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Re: controlling the backspace key
- From: javascript@xxxxxxxxxx (Bill Marriott)
- Subject: [Javascript] Re: controlling the backspace key
- Date: Sun, 24 Nov 2002 20:45:25 +1100
Hi Everyone,
The following code traps the key stroke "backspace" in a web form so that
the user can't navigate back to the last page.
However I would like to engage the function only when the user is not in a
form element.
Does anyone know what code I should use?
Thanks
Bill Marriott
function mykeyhandler() {
if (window.event && window.event.keyCode == 8) { // try to cancel the
backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
document.onkeydown = mykeyhandler;
- References:
- [Javascript] Need help in Hiding Controls inHTML
- From: Evans Ligare
- [Javascript] Need help in Hiding Controls inHTML
- Prev by Date: [Javascript] Need help in Hiding Controls inHTML
- Next by Date: [Javascript] print
- Previous by thread: [Javascript] Need help in Hiding Controls inHTML
- Next by thread: [Javascript] Need help in Hiding Controls inHTML
- Index(es):