网页上的每个组件,元素都有onfocus事件,即焦点事件,包括网页本身。
两个页面之间切换会激发网页的焦点事件,window.onfocus .


<javascript>
window.onfocus=function (){alert("test");};
</javascript>
当两个网页切换时,含有上面方法的页面在获得焦点时会激发onfocus事件,弹出一提示框test

相关文章:

  • 2022-03-10
  • 2021-07-20
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
相关资源
相似解决方案