事件
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 [鼠标释放时]