JS实现屏蔽键盘操作

第一种:当页面初始加载的时候,屏蔽掉当前页面所有的键盘

$(document).ready(function () {
 document.body.onkeydown = function (event) {
 if (window.event) {
 //alert("不允许使用任何键盘按键");
 return false;
}
}
});

第二种,当按某一按键,执行的时候,屏蔽键盘所有操作

<a href="#" onclick="AgreeApply(1, '@item.ID')" onkeydown="keydown(event)">同意</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="AgreeApply(2, '@item.ID')" onkeydown="keydown(event)">拒绝</a>

function keydown(event) {
if (window.event) {
//alert("不允许使用任何键盘按键");
return false;
}
}

原文地址:https://www.cnblogs.com/eyunhua/p/3713150.html