codice:
var e;
var tuaFunzione = function(e){
if(e.keyCode==113) alert("f2");
return false;
}
document.onkeypress=function(e){
e = e || window.event;
tuaFunzione(e);
return false;
}
Gestisci l'evento anche nella funzione e falle ritornare comunque false.