window.onload = function () { // 等所有东西加载完毕 在执行里面的内容 var main = document.getElementById("main"); console.log(main) }