对比参照jQuery$(document).ready(function() { // executes when HTML-Document is loaded and DOM is ready alert("document is ready"); }); $(window).load(function() { // executes when complete page is fully loaded, including all frames, objects and images alert("window is loaded"); });
脚本语言是无法单独使用的,脚本语言只能够寄生在某个具体的宿主环境中才能够工作。
例如,在客户端浏览器的宿主环境
像window,document,onload,scrollTop都是浏览器的宿主环境提供的在《javascript手册》中一般只有javascript脚本语言本身的内容。没有宿主的内容
http://www.w3school.com.cn/tags/html_ref_eventattributes.asp
去下一个W3SCHOOL离线版的吧
// executes when HTML-Document is loaded and DOM is ready
alert("document is ready");
});
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
//
})