「back space」キー禁止
//キー押下時
window.document.onkeydown=onKeyDown;
//BackSpaceキー押下防止
function onKeyDown(e) {
if (navigator.appName == "Microsoft Internet Explorer") {
//ALT+←ダメ
if( event.keyCode == 0x25 && event.altKey == true ) {
//alert("ALT+←はダメ!");
return false ;
}
//テキストボックス、パスワードボックスは許す
for (i = 0; i < document.all.tags("INPUT").length; i++) {
if (document.all.tags("INPUT")(i).name == window.event.srcElement.name &&
(document.all.tags("INPUT")(i).type == "text" || document.all.tags("INPUT")(i).type == "password") &&
document.all.tags("INPUT")(i).readOnly == false){
return true;
}
}
//テキストエリアは許す
for (i = 0; i < document.all.tags("TEXTAREA").length; i++) {
if (document.all.tags("TEXTAREA")(i).name == window.event.srcElement.name &&
document.all.tags("TEXTAREA")(i).readOnly == false){
return true;
}
}
//BackSpaceダメ
if( event.keyCode == 8 ) {
//alert("BackSpaseはダメ!");
return false ;
}
} else
if (navigator.appName == "Netscape") {
if (e.which == 8) {
return false;
}
}
}