目录

HTML 事件方法


HTML DOM 事件允许 JavaScript 在 HTML 文档中的元素上注册不同的事件处理程序。

事件通常与函数结合使用,并且在事件发生之前(例如当用户单击按钮时)不会执行函数。

有关事件的教程,请阅读我们的JavaScript 事件教程


HTML DOM 事件方法

Method Description Belongs To
getModifierState() Returns true if a specified key is activated MouseEvent
getTargetRanges() Returns an array containing target ranges that will be affected by the insertion/deletion InputEvent
preventDefault() Cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur Event
stopImmediate
Propagation()
Prevents other listeners of the same event from being called Event
stopPropagation() Prevents further propagation of an event during event flow Event