[关闭]
@File 2019-10-08T09:31:33.000000Z 字数 7143 阅读 204

常见事件

web


一、鼠标事件

auxclick:在元素上按下并释放任意非主按键(如:鼠标中键)

click:在元素上按下并释放任意鼠标按键。

contextmenu:右键点击(在右键菜单显示前触发)。

dblclick:在元素上双击鼠标按钮。

mousedown:在元素上按下任意鼠标按钮。

mouseenter:指针移到有事件监听的元素内。

mouseleave:指针移出元素范围外(不冒泡)。

mousemove:指针在元素内移动时持续触发。

mouseover:指针移到有事件监听的元素或者它的子元素内。

mouseout:指针移出元素,或者移到它的子元素上。

mouseup:在元素上释放任意鼠标按键。

pointerlockchange:鼠标被锁定或者解除锁定发生时。

pointerlockerror:可能因为一些技术的原因鼠标锁定被禁止时。

select:有文本被选中。

wheel:滚轮向任意方向滚动。

二、键盘事件

keydown:按下任意按键。

keypress:除 Shift、Fn、CapsLock 外的任意键被按住。(连续触发。)

keyup:释放任意按键。

三、焦点事件

focus:元素获得焦点(不会冒泡)。

blur:元素失去焦点(不会冒泡)。

四、WebSocket 事件

open:WebSocket 连接已建立。

message:通过 WebSocket 接收到一条消息。

error:WebSocket 连接异常被关闭(比如有些数据无法发送)。

close:WebSocket 连接已关闭。

五、剪贴板事件

cut:已经剪贴选中的文本内容并且复制到了剪贴板。

copy:已经把选中的文本内容复制到了剪贴板。

paste:从剪贴板复制的文本内容被粘贴。

六、拖放事件

drag:正在拖动元素或文本选区(在此过程中持续触发,每 350ms 触发一次)

dragend:拖放操作结束。(松开鼠标按钮或按下 Esc 键)

dragenter:被拖动的元素或文本选区移入有效释放目标区

dragstart:用户开始拖动HTML元素或选中的文本

dragleave:被拖动的元素或文本选区移出有效释放目标区

dragover:被拖动的元素或文本选区正在有效释放目标上被拖动 (在此过程中持续触发,每350ms触发一次)

drop 元素在有效释放目标区上释放

七、网络事件

online:浏览器已获得网络访问。

offline:浏览器已失去网络访问。

八、资源事件

error:资源加载失败时。

abort:正在加载资源已经被中止时。

load:资源及其相关资源已完成加载。

beforeunload:window,document 及其资源即将被卸载。

unload:文档或一个依赖资源正在被卸载。

select:有文本被选中。

wheel:滚轮向任意方向滚动。

九、表单事件

reset:点击重置按钮时

submit:点击提交按钮

十、打印事件

beforeprint:打印机已经就绪时触发

afterprint:打印机关闭时触发

十一、CSS 动画事件

animationstart:某个 CSS 动画开始时触发。

animationend:某个 CSS 动画完成时触发。

animationiteration:某个 CSS 动画完成后重新开始时触发。

十二、CSS 过渡事件

transitionru:某个 CSS 完成过渡开始时触发。(在任何延迟之前触发)

transitionstart:某个 CSS 完成过渡开始时触发。(在任何延迟之后触发)

transitioncancel:某个 CSS 完成过渡被取消时触发。

transitionend:某个 CSS 完成过渡后触发。

十三、会话历史事件

pagehide:在用户离开当前网页跳转到另外一个页面时触发。

pageshow:在用户访问页面时触发。

popstate:在窗口的浏览历史(history 对象)发生改变时触发。

十四、视图事件

fullscreenchange:元素被转换为全屏模式或回到正常模式。

fullscreenerror:转换全屏模式失败

resize:当窗口或框架被重新调整大小时触发。

scroll:当滚动条滚动时触发。

十五、文本输入事件

compositionstart:若干可见字符的输入之前触发。(可见字符的输入可能需要一连串的键盘操作、语音识别或者点击输入法的备选词)

compositionupdate:输入过程中每次按键时触发。(start 之后 end 之前)

compositionend:输入完成或取消后触发。

十六、媒体事件

audioprocess:The input buffer of a ScriptProcessorNode is ready to be processed.

canplay:The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.

canplaythrough:The browser estimates it can play the media up to its end without stopping for content buffering.

complete:The rendering of an OfflineAudioContext is terminated.

durationchange:The duration attribute has been updated.

emptied:The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.

ended:Playback has stopped because the end of the media was reached.

loadeddata:The first frame of the media has finished loading.

loadedmetadata:The metadata has been loaded.

pause:Playback has been paused.

play:Playback has begun.

playing:Playback is ready to start after having been paused or delayed due to lack of data.

ratechange:The playback rate has changed.

seeked:A seek operation completed.

seeking:A seek operation began.

stalled:The user agent is trying to fetch media data, but data is unexpectedly not forthcoming.

suspend:Media data loading has been suspended.

timeupdate:The time indicated by the currentTime attribute has been updated.

volumechange:The volume has changed.

waiting:Playback has stopped because of a temporary lack of data.

十七、进度事件

abort:Progression has been terminated (not due to an error).

error:Progression has failed.

load:Progression has been successful.

loadend:Progress has stopped (after "error", "abort" or "load" have been dispatched).

loadstart:Progress has begun.

progress:In progress.

timeout:Progression is terminated due to preset time expiring.

十八、存储事件

change:(see Non-standard events)

storage

十九、更新事件

checking

downloading

error

noupdate

obsolete

updateready

二十、值变化事件

broadcast

CheckboxStateChange

hashchange

input

RadioStateChange

readystatechange

ValueChange

二一、未分类的事件节

invalid

message

message

open

show

相关连接:

参考网站

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注