DOMContentLoaded事件先执行,load事件后执行。
document.addEventListener('DOMContentLoaded', function () {
    console.log(1)
});

window.onload = function () {
    console.log(2)
}

 

相关文章:

  • 2022-12-23
  • 2021-09-30
  • 2017-12-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
  • 2021-06-01
相关资源
相似解决方案