首页 相关文章 event.currentTarget和document.activeElement用法

event.currentTarget和document.activeElement用法

firefox 的 event.currentTarget 和 ie 的 document.activeElement 这两个完全含义不一致的对象却被捆绑在一起做成了浏览器兼容代码。 大家在的时候 都会发现 document.activeElement || event.currentTarget 的用法。

其实这样的用法是错误的,因为这两个属性的意义都不一样。

Identifies the current target for the event, as the event traverses the DOM.

识别当前事件触发的dom

Gets the object that has the focus when the parent document has focus.

获得当前focus的对象

例子

script type="text/javascript"
var show = functio...[ 查看全文 ]

2016-02-19 标签:

event.currentTarget和document.activeElement用法的相关文章

手机页面
收藏网站 回到头部