function f_KeyDown(evt){
// Captura a tecla Digitada
// code for IE
var evt = window.event;
var pressedKey = String.fromCharCode(evt.keyCode).toLowerCase();
//Desabilita o CTRL-C, V, X e P
if (window.event.ctrlKey && (pressedKey == "c" || pressedKey == "v" || pressedKey == "x" || pressedKey == "p")) {
// disable key press porcessing
cancelKey(evt);
}
//Desabilita o BACKSPACE e ESC.
if ( evt.keyCode==08 || evt.keyCode==27){
// disable key press porcessing
cancelKey(evt);
}
//Desabilita o F5.
if ( evt.keyCode==116){
// disable key press porcessing
cancelKey(evt);
}
}
function cancelKey(evt){
if (evt.preventDefault) {
evt.preventDefault();
return false;
}else {
evt.keyCode = 0;
evt.returnValue = false;
}
}
segunda-feira, 27 de setembro de 2010
Desabilita o botão direito no browser
//inserir no header
document.oncontextmenu = function(){return false};
document.oncontextmenu = function(){return false};
Capturar Teclas Digitadas no browser
function getKey(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
key = String.fromCharCode(keycode).toLowerCase();
}
}
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
key = String.fromCharCode(keycode).toLowerCase();
}
}
Assinar:
Postagens (Atom)