是否有人能告诉我在JavaScript中实现HTML事件处理程序与DOM级别0事件处理程序有什么区别?HTML事件处理程序与DOM级别0事件处理程序之间的区别
5
A
回答
0
DOM0事件是在HTML和XHTML规格固有事件定义的声明事件:
内在事件是配合使用元素的属性,可以有当某些动作由执行特定事件发生用户。只有在选择了定义这些元素的模块时,才会将下表中指示的属性添加到它们各自元素的属性集中。
标记语言的某些元素可能具有关联的事件处理程序,它们在发生某些事件时被激活。用户代理需要能够用静态关联的事件处理程序来标识这些元素(即,在内容中关联,而不是在脚本中)。在HTML 4([HTML4],第18.2.3节)中,内部事件由以“on”开头的属性指定:
onblur, onchange, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreset, onselect, onsubmit, and onunload
。Internet Explorer对于使用属性分配的DOM Level 0方法定义的事件处理程序具有正确的作用域,但在使用
attachEvent()
时不适用。
The Level 0 DOM supports the following nodeLists: document.images[], which grants access to all images on the page. document.forms[], which grants access to all forms on the page. document.forms[].elements[], which grants access to all form fields in one form, whatever their tag name. This nodeList is unique to the Level 0 DOM; the W3C DOM does not have a similar construct. document.links[], which grants access to all links() on the page. document.anchors[], which grants access to all anchors() on the page.
在本说明书中定义的焦点事件发生相对于彼此的一组顺序英寸
Event Name Notes 1. focusin Sent before first target element receives focus 2. focus Sent after first target element receives focus 3. focusout Sent before first target element loses focus 4. focusin Sent before second target element receives focus 5. blur Sent after first target element loses focus 6. focus Sent after second target element receives focus
以下是事件的典型序列当一个焦点是:当一个焦点的元件之间移动(该顺序假定没有元件被最初集中)以下是事件的典型序列在元素之间移动,包括不推荐使用的DOMFocusIn和DOMFocusOut事件。显示的顺序假定最初没有元素被聚焦。
C.2.1 Legacy FocusEvent event order Event Name Notes 1. focusin Sent before first target element receives focus 2. focus Sent after first target element receives focus 3. DOMFocusIn If supported 4. focusout Sent before first target element loses focus 5. focusin Sent before second target element receives focus 6. blur Sent after first target element loses focus 7. DOMFocusOut If supported 8. focus Sent after second target element receives focus 9. DOMFocusIn If supported
HTML事件是在DOM规范定义为HTMLEvents势在必行事件:
<iframe src="https://www.w3.org/DOM/Graphics/dom2-map.svg" width="900" height="400"></iframe>
<img src="https://www.w3.org/TR/DOM-Level-3-Events/images/eventflow.svg" width="400" height="400"/>
参考
相关问题
- 1. HTML事件处理程序与React事件处理程序
- 2. 事件处理程序和回调函数之间的区别
- 3. 查看DOM级别2 IE中的事件处理程序
- 4. 静态事件处理程序和非静态事件处理程序之间有什么区别
- 5. 事件处理程序和事件侦听器之间有什么区别?
- 6. PageLoaded事件处理程序在应用程序级别
- 7. 分配事件处理程序与jQuery中的bind()和each()之间的区别?
- 8. 这和DOM在事件处理程序
- 9. 仅针对包级别的SSIS事件处理程序
- 10. 的事件处理程序
- 11. UIPickerView:didSelectRow方法和Value Changed事件处理程序方法之间的区别
- 12. nativeElement.click()和事件处理程序的点击之间有什么区别?
- 13. 关键事件处理程序不在表单级别触发
- 14. 在Web应用程序级别同时处理事件?
- 15. 处理程序不处理事件
- 16. Reactive extensions处理事件处理程序
- 17. C#静态事件处理程序与非静态事件处理程序
- 18. click事件处理程序和ngClick指令有什么区别?
- 19. C#事件处理程序
- 20. MFC事件处理程序
- 21. MsftDiscFormat2Data事件处理程序
- 22. 事件处理程序
- 23. wpf事件处理程序
- 24. JavaScript事件处理程序
- 25. 事件处理程序TabbedPanel
- 26. DRYing事件处理程序
- 27. 事件处理程序
- 28. Elixir事件处理程序
- 29. Javascript事件处理程序
- 30. BackgroundWorker事件处理程序
这可能对您有用:http://stackoverflow.com/q/5642659/830125 –
非常感谢您,但它并没有真正回答这个区别是什么 – Jonny
没有DOM L0规范,该术语仅用于指非标准的广泛功能。然后他们在HTML中被标准化。 – Oriol