Im trying to run this in IE 8 but it doesn\'t work, any idea? It works in Firefox, Chrome, Opera...
preventBackspace();
function preventBackspace() {
tr
Use document.attachEvent instead. :]
It appears that only IE9 and later support binding keydown
on window
: http://www.quirksmode.org/dom/events/keys.html#t00
Instead, bind it to the document
for IE:
function preventBackspace() {
try {
if (window.addEventListener) {
window.addEventListener("keydown", onKeyDown, true);
} else if (document.attachEvent) { // IE
alert(document);
document.attachEvent("onkeydown", onKeyDown);
} else {
document.addEventListener("keydown", onKeyDown, true);
}
} catch (e) {
alert(e);
}
}