如何避免在IE内核时,按BackSpace时进行网页会进行回退

//解决在IE浏览器中input被设置成readonly时,点击Backspace时会出现网页回退
document.onkeydown = check;
function check(e) {
  var code;
  if (!e) var e = window.event;
  if (e.keyCode) code = e.keyCode;
  else if (e.which) code = e.which;
  if (((event.keyCode == 8) && //BackSpace
  ((event.srcElement.type != "text" &&
  event.srcElement.type != "textarea" &&
  event.srcElement.type != "password") ||
  event.srcElement.readOnly == true)) ||
  ((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82)) ) || 
  (event.keyCode == 116) ) {
        event.keyCode = 0;
    event.returnValue = false;
  }
  return true;
}

上一篇:Java集合Map接口与Map.Entry学习


下一篇:Java中的Class.forName