#DOMContentLoaded

DOMContentLoaded和load

DOMContentLoaded事件先执行,load事件后执行。document.addEventListener('DOMContentLoaded',function(){console.log(1)});window.onload=function(){console.log(2)} ...
代码星球 ·2020-04-05