告诉浏览器要在页面全部加载完之后再运行js:
function init()
{
var planet = document.getElementById ("greenplanet");
planet.innerHTML = "Red Alert";
}
window.onload = init; //使用window对象的onload属性,运行函数
告诉浏览器要在页面全部加载完之后再运行js:
function init()
{
var planet = document.getElementById ("greenplanet");
planet.innerHTML = "Red Alert";
}
window.onload = init; //使用window对象的onload属性,运行函数