document.onkeydown = function (e) {
var code;
if (!e){ var e = window.event;}
if (e.keyCode){ code = e.keyCode;}
else if (e.which){ code = e.which;}
//BackSpace 8;
if (
(event.keyCode == 8)
&& ((event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")
|| event.srcElement.readOnly == true
)
) {
event.keyCode = 0;
event.returnValue = false;
}
return true;
};
网页屏蔽Backspace事件,输入框不屏蔽
最新推荐文章于 2018-08-09 11:23:00 发布