html事件触发,HTML事件触发列表

一般事件onClick 鼠标点击事件,多用在某个对象控制的范围内的鼠标点击

onDblClick 鼠标双击事件

onMouseDown 鼠标上的按钮被按下了

onMouseUp 鼠标按下后,松开时激发的事件

onMouseOver 当鼠标移动到某对象范围的上方时触发的事件

onMouseMove 鼠标移动时触发的事件

onMouseOut 当鼠标离开某对象范围时触发的事件

onKeyPress 当键盘上的某个键被按下并且释放时触发的事件.[注意:页面内必须有被聚焦的对象]

onKeyDown 当键盘上某个按键被按下时触发的事件[注意:页面内必须有被聚焦的对象]

onKeyUp 当键盘上某个按键被按放开时触发的事件[注意:页面内必须有被聚焦的对象]

页面相关事件

onAbort 图片在下载时被用户中断

onBeforeUnload 当前页面的内容将要被改变时触发的事件

onError 捕抓当前页面因为某种原因而出现的错误,如脚本错误与外部数据引用的错误

onLoad 页面内空完成传送到浏览器时触发的事件,包括外部文件引入完成

onMove 浏览器的窗口被移动时触发的事件

onResize 当浏览器的窗口大小被改变时触发的事件

onScroll 浏览器的滚动条位置发生变化时触发的事件

onStop 浏览器的停止按钮被按下时触发的事件或者正在下载的文件被中断

onUnload 当前页面将被改变时触发的事件

Window Events

窗口事件

Only valid in body and frameset elements.

只在body和frameset元素中才有效

Attribute

属性

Value

Description

描述

onload

script

Script to be run when a document loads

装载时

onunload

script

Script to be run when a document unloads

卸载时

Form Element Events

表单元素事件

Only valid in form elements.

在表单元素中才有效。

Attribute

属性

Value

Description

描述

onchange

script

Script to be run when the element changes

当元素有改变时脚本会执行

onsubmit

script

Script to be run when the form is submitted

当表单提交时...

onreset

script

Script to be run when the form is reset

当表单重置时...

onselect

script

Script to be run when the element is

selected

元素被选中时...

onblur

script

Script to be run when the element loses

focus

元素失去焦点时...

onfocus

script

Script to be run when the element gets focus

元素得到焦点时...

Keyboard Events

键盘事件

Not valid in base, bdo, br, frame, frameset, head, html, iframe,

meta, param, script, style, and title elements.

在 base, bdo, br, frame, frameset, head, html, iframe, meta, param,

script, style,和 title 元素里都无效.

Attribute

属性

Value

Description

描述

onkeydown

script

What to do when key is pressed

当键按下时做什么

onkeypress

script

What to do when key is pressed and released

当键按下然后释放时做什么

onkeyup

script

What to do when key is released

当键释放时做什么

Mouse Events

鼠标事件

Not valid in base, bdo, br, frame, frameset, head, html, iframe,

meta, param, script, style, title elements.

在 base, bdo, br, frame, frameset, head, html, iframe, meta, param,

script, style,和 title 元素里都无效.

Attribute

属性

Value

Description

描述

onclick

script

What to do on a mouse click

单击时...

ondblclick

script

What to do on a mouse double-click

双击时...

onmousedown

script

What to do when mouse button is pressed

按下时...

onmousemove

script

What to do when mouse pointer moves

移动时...

onmouseout

script

What to do when mouse pointer moves out of an

element

鼠标移开元素时

onmouseover

script

What to do when mouse pointer moves over an

element

鼠标在元素上方时

onmouseup

script

What to do when mouse button is released

鼠标释放时

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值