激活前启用JavaScript

JavaScript onbeforedeactivate

本文关键字:JavaScript 启用 激活      更新时间:2023-09-26

Internet Explorer 8

<input id="txt" type"text" />
<input id="but" type="button" value="button1" />
document.getElementById("txt").attachEvent("onbeforedeactivate", function (ev) {
  ev.returnEvent = false;
  return false;
});
document.getElementById("but").attachEvent("onclick", function (ev) {
  alert(99);
});

从关注输入开始(类型=文本)
当我单击该按钮时,我希望只触发onbeforedeactivate事件,而不是onclick事件
有解决方案吗?

attachEvent附加事件侦听器时,event对象可以在window.event属性中找到,而不是在回调函数的第一个参数中。