How to disable the backspace button
August 6, 2009 12:00 AM
This is from a Linked in conversation, replace it with the backspace key code "8" :
Here is what you can do. You need to intercept the function calls that the browser makes. First you need to know the Key Codes of the keys you are trying to intercept. Here is a good reference that I use: http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html
So for the F keys the key codes are 112-123 excluding 121.
Next you need to write the javascript to listen to the key strokes, and assign the key stokes a new function.
Put this in as an external HTML object, type: Header Scripting
document.onkeydown = myKeyDown;
function myKeyDown(theEvt){
theEvt = (theEvt) ? theEvt : ((event) ? event : null);
if(theEvt){
if ((theEvt.keyCode==112)){
alert('You have pressed F1');
}
if ((theEvt.keyCode==113)){
alert('You have pressed F2');
}
if ((theEvt.keyCode==114)){
alert('You have pressed F3');
}
if ((theEvt.keyCode==115)){
alert('You have pressed F4');
}
if ((theEvt.keyCode==116)){
alert('You have pressed F5');
}
if ((theEvt.keyCode==117)){
alert('You have pressed F6');
}
if ((theEvt.keyCode==118)){
alert('You have pressed F7');
}
if ((theEvt.keyCode==119)){
alert('You have pressed F8');
}
if ((theEvt.keyCode==120)){
alert('You have pressed F9';
}
if ((theEvt.keyCode==122)){
alert('You have pressed F11');
}
if ((theEvt.keyCode==123)){
alert('You have pressed F12');
}
}
}
Now you just need to replace the alert actions with another function. For example you can set F4 to go to the next page, by using this code:
if ((theEvt.keyCode==115)){
trivNextPage();
}
Let me know if you have any questions.
Discussions have been disabled for this post