document.onclick vs window.onclick
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的更多相关文章
- $(document).ready和window.onload 简单分析区别
<锋利的JQuery>翻开没看几页,就遇到了这个神奇的问题,之前在橙旭园学习的时候,JQuery只教了一些基础的,像链式操作等,那时以为这个和window.onload()差不多一模一样, ...
- $(document).ready() 与$(window).load()
虽说很早就开始接触JavaScript,自己也用JavaScript编写过许多代码,如之前的web版码表计时器,就写了近500行代码,函数也写了10个左右.当时也就是想到哪里就写到哪里,行不通就另外找 ...
- Document对象和window对象
window对象--- 代表浏览器中的一个打开的窗口或者框架,window对象会在<body>或者<frameset>每次出现时被自动创建,在客户端JavaScript中,Wi ...
- jquery mobile在页面加载时添加加载中效果 document.ready 和window.onload执行顺序比较
想要添加这个效果,先来弄明白页面的加载和事件执行顺序,看这个简单例子: <html xmlns="http://www.w3.org/1999/xhtml"> < ...
- $(document).ready() 与 window.onload 之间的区别
1.执行时机 window.onload 是网页中所有的元素都加载到浏览器后才执行 $(document).ready() 是dom完全就续就可以调用 例如:如果给一副图片添加点击事件,window. ...
- jQuery $(document).ready()和window.onload
jQuery $(document).ready()和window.onload 根据ready()方法的API说明http://api.jquery.com/ready/. 这个方法接收一个func ...
- 详解;(function ($,window,document,undefined){...})(jQuery,window,document);
1.代码最前面的分号,可以防止多个文件压缩合并以为其他文件最后一行语句没加分号,而引起合并后语法错误. 2.匿名函数(function(){})();:由于Javascript执行表达式是从圆括号里面 ...
- $(document).ready vs $(window).load vs window.onload
原文地址: $(document).ready vs $(window).load vs window.onload $(document).ready We execute our code whe ...
- 转载jquery $(document).ready() 与window.onload的区别
jquery $(document).ready() 与window.onload的区别 投稿:mdxy-dxy 字体:[增加 减小] 类型:转载 时间:2009-12-28我要评论 Jquery中$ ...
随机推荐
- java编程小技巧
1.缩进与反缩进 缩进:tab 反缩进:shift+tab 2.整段注释和取消整段注释 整段注释:ctrl+shift+/ 取消整段注释:ctrl+shift+\
- C++ 性能剖析 (二):值语义 (value semantics)
Value Semantics (值语义) 是C++的一个有趣的话题. 什么是值语义? 简单的说,所有的原始变量(primitive variables)都具有value semantics. 也可以 ...
- 如何获取网站icon
获取网站icon,常用最简单的方法就是通过website/favicon.ico来获取,不过由于很多网站都是在页面里面设置favicon(<link rel="shortcut ico ...
- win7 snmp
http://blog.chinaunix.net/uid-21857285-id-3340206.html
- ANTLR
http://dreamhead.blogbus.com/logs/10756716.html
- Cracking the coding interview--Q1.8
原文: Assume you have a method isSubstring which checks if one word is a substring of another. Given t ...
- Activity大致会经过如下四个状态
1.活动主题:当前Activity位于前台,用户可见,可以获得焦点.2.暂停状态:其他Activity位于前台,该Activity依然可见,只是不能获得焦点.3.停止状态:该Activity不可见,失 ...
- rsyslog 一重启就会开始同步之前所有通配的日志文件
<pre name="code" class="html">[root@dr-mysql01 zjzc_log]# grep '24/Sep/201 ...
- iOS 9之分屏多任务(Split View)
金田(github 示例源码) 多任务(multitasking)算是iOS9中最引人瞩目的核心新特性了,之前越狱版用户就用过类似的插件,微软的 苏菲 (Windows Surface)系列也有分屏多 ...
- WinForm ListControl MouseWheel Envent
最近在使用Listbox开发程序的时候, 遇到MouseWheel event 异常. 设置如下: 1. DrawModel:ownerDrawVariable. 2. InternalHeight: ...