[译]JavaScript事件(一)目录
学习js的时候,碰见很多莫名其妙的问题,特别是写跨浏览器支持的脚本时。有时候也会为一些看起来很简单的问题难住。前两天有人问为什么弹出确认窗口时要return false。我只知道大家都是这么做的,不知道原因。在查找为什么的时候,看到一个网站http://www.quirksmode.org/里面的js解释的非常详细了,特别是事件处理。搜了一下,还没有中文的版本,就打算把这个网站上的Event部分翻译出来,解释一些简单的js知识,给初学者一些帮助。
本页原文链接:http://www.quirksmode.org/js/contents.html
事件用户采取某种行为,事件被触发。大多数脚本由此开始执行。 |
|
事件的简单介绍 | 简单介绍事件处理程序。概述正确的问题和正确的回答。 |
事件 | 跨浏览器的事件的详细介绍 |
早期的事件处理程序 | 本页解释最古老的添加事件处理程序的方法。甚至连第二代浏览器都支持 |
传统的事件注册模式 | 本页介绍传统事件处理模式,在左右现代浏览器都支持。还讨论了匿名函数和此模式的小缺点 |
Advanced models | This page discusses the advanced event registration models of W3C and Microsoft. W3C's model is good, Microsoft's isn't. |
Event accessing | This page explains how to access an event object. This is necessary if you want to read out event properties. |
Event properties | This page discusses interesting event properties and the severe browser incompatibilities surrounding their use. |
Event order | This page discusses the two event order models. When the user clicks on a nested element and both this element and its parent element have an onclick event handler, which one fires first? |
Mouse events | Detailed treatment of the mouse events: mouseover, mouseout, mousedown, mouseup, mousemove, click and dblclick. |
Event compatibility tables | Compatibility tables for the most common events. |
Event pairs | To keep our sites accessible to non-mouse users we must use non-mouse events likefocus or keydown in addition to mouse events. Which non-mouse events can be paired with which mouse events? |
Detecting keystrokes | How to detect the keys the user pressed. The details are messy. |
addEventSimple | My utility function for simple unobtrusive event handler creation |
已经翻译的用中文显示,并给出翻译后的文章地址。尚未翻译的显示英文,给出的是原文链接。
第一次翻译错误和不恰当的地方,欢迎大家指出。
作者:Kamal
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。