The JavaScript Window object is the highest level JavaScript object which corresponds to the web browser window.

最外层的JavaScript对象其对应于web浏览器窗口

The document object is the container for all HTML HEAD and BODY objects associated within the HTML tags of an HTML document. This could correspond to the top-most window, or an iframe within the window.

文档对象是一个HTML文档的HTML标签中相关联的所有HTML头部和身体对象的容器. 这可以对应于最上面的窗口,或在窗口内的iframe

Update

After a quick test there really is no difference between the two. However, as others have said, window.onclick did not work when tested in IE8. So apparently the bottom line is that document.onclick is the preferred choice.

window.onclick 不能在IE8下工作,在低版本中 document.onclick 为首选

document.onclick vs window.onclick的更多相关文章

  1. $(document).ready和window.onload 简单分析区别

    <锋利的JQuery>翻开没看几页,就遇到了这个神奇的问题,之前在橙旭园学习的时候,JQuery只教了一些基础的,像链式操作等,那时以为这个和window.onload()差不多一模一样, ...

  2. $(document).ready() 与$(window).load()

    虽说很早就开始接触JavaScript,自己也用JavaScript编写过许多代码,如之前的web版码表计时器,就写了近500行代码,函数也写了10个左右.当时也就是想到哪里就写到哪里,行不通就另外找 ...

  3. Document对象和window对象

    window对象--- 代表浏览器中的一个打开的窗口或者框架,window对象会在<body>或者<frameset>每次出现时被自动创建,在客户端JavaScript中,Wi ...

  4. jquery mobile在页面加载时添加加载中效果 document.ready 和window.onload执行顺序比较

    想要添加这个效果,先来弄明白页面的加载和事件执行顺序,看这个简单例子: <html xmlns="http://www.w3.org/1999/xhtml"> < ...

  5. $(document).ready() 与 window.onload 之间的区别

    1.执行时机 window.onload 是网页中所有的元素都加载到浏览器后才执行 $(document).ready() 是dom完全就续就可以调用 例如:如果给一副图片添加点击事件,window. ...

  6. jQuery $(document).ready()和window.onload

    jQuery $(document).ready()和window.onload 根据ready()方法的API说明http://api.jquery.com/ready/. 这个方法接收一个func ...

  7. 详解;(function ($,window,document,undefined){...})(jQuery,window,document);

    1.代码最前面的分号,可以防止多个文件压缩合并以为其他文件最后一行语句没加分号,而引起合并后语法错误. 2.匿名函数(function(){})();:由于Javascript执行表达式是从圆括号里面 ...

  8. $(document).ready vs $(window).load vs window.onload

    原文地址: $(document).ready vs $(window).load vs window.onload $(document).ready We execute our code whe ...

  9. 转载jquery $(document).ready() 与window.onload的区别

    jquery $(document).ready() 与window.onload的区别 投稿:mdxy-dxy 字体:[增加 减小] 类型:转载 时间:2009-12-28我要评论 Jquery中$ ...

随机推荐

  1. 武汉科技大学ACM :1001: A+B for Input-Output Practice (I)

    Problem Description Your task is to Calculate a + b. Too easy?! Of course! I specially designed the ...

  2. osg for android (一) 简单几何物体的加载与显示

    1. 首先需要一个OSG for android的环境. (1).NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一) ...

  3. Css预处理器实践之Sass、Less大比拼

    xwei | 2012-07-07 | 网页重构 什么是CSS预处理器? Css可以让你做很多事情,但它毕竟是给浏览器认的东西,对开发者来说,Css缺乏很多特性,例如变量.常量以及一些编程语法,代码难 ...

  4. HTML5 canvas中的路径方法

    路径方法 fill()                                填充当前绘图(路径) stroke()                        绘制已定义的路径 begin ...

  5. jQuery的map()与jQuery.map()总结

    请注意他们不是同一个函数.前者是jQuery对象的实例方法(即$.fn.map),后者是一个仅仅挂在jQuery对象下的静态方法(即$.map). 他们用法的异同:map()的返回值是包裹了一个Arr ...

  6. Python自动化运维之9、模块之sys、os、hashlib、random、time&datetime、logging、subprocess

    python模块 用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需 ...

  7. R: for installing package 'RODBC'

    Today, i try to install a package in R named 'DOBDC', while i meet a message: > install.packages( ...

  8. 转:Durandal快速入门

    Durandal是一个轻量级的JavaScript框架,其目标是单页面应用(SPAs)的开发变得简单而优雅.它支持MVC.MVP和MVVM等模式,因此不论你采用哪种类型的前端架构,Durandal都能 ...

  9. LeetCode _ Gas Station

    There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...

  10. 让自己的C++程序(非服务程序)运行为一个windows service

    因为项目的一些变化和原因,需要把数据处理的一个后台程序创建为一个windows服务,运行以下命令能创建成功: sc create "MyApp Service Name" binP ...