en realidad es algo sencillo
Cita: var key;
function fnc(evt) {
var keyCode = (document.all) ? evt.keyCode : evt.which;;
if (key == keyCode) {
key = keyCode;
parar(String.fromCharCode(keyCode));
} else {
key = keyCode;
}
}
function parar() {
document.getElementById('txt').value = document.getElementById('txt').value.substr(0, document.getElementById('txt').value.length-1);
}
<input type="text" value="" id="txt" onkeypress="fnc(event)" />