Home  >  Article  >  Web Front-end  >  What event attributes does HTML have?

What event attributes does HTML have?

青灯夜游
青灯夜游Original
2020-11-20 14:02:293298browse

html event attributes include: onblur, onerror, onfocus, onsubmit, onkeydown, onkeypress, onclick, ondblclick, onmousedown, onmousemove, onmouseout, etc.

What event attributes does HTML have?

HTML Event Properties

Window Event Properties

Events triggered for the window object.

Applies to Tags:

##AttributeValueDescriptiononafterprint#Run the script after printing the documentonbeforeprintRun the script before the document printsonbeforeonloadRun the script before the document loadsonblurRun the script when the window loses focusonerrorRun the script when an error occursonfocusRun script when window gets focusonhaschangeRun script when document changesonloadRun script when document loads onmessageRun script when message is triggered onofflineRun script when document is offlineononlineRun script when document goes onlineonpagehideWhen window is hidden Run scriptonpageshowRun script when window is visibleonpopstateRun script when window history changesonredoRun the script when the document performs a redo operationonresizeRun script when window is resizedonstorageWhen Web Storage area is updated Run the script when (when the data in the storage space changes)onundoWhen the document performs undo Run the scriptonunloadRun the script when the user leaves the document
script
script
script
script
script
script
script
script
script
#script
script
script
script
script
script
script
script
script
script

Form events

Events triggered by actions inside HTML forms.

Applies to all HTML 5 elements, but is most commonly used in form elements:

AttributesValue DescriptiononblurRun script when element loses focusonchangeRun script when element changesoncontextmenuRun script when context menu is triggeredonfocusWhen Run script when element gets focusonformchangeRun script when form changesonforminputScript that runs when the form gets user inputoninputRun script when element gets user inputoninvalidRun script when element is invalid onresetRun when form resets script. onselectRun script when an element is selectedonsubmitRun script when form is submitted
script
script
script
script
script
script
script
script
script HTML 5 is not supported.
script
script

Keyboard events

Events triggered by the keyboard.

Applies to all HTML 5 elements:

AttributesValueDescriptiononkeydownRun script when key is pressedonkeypressRun script when key is pressed and releasedonkeyupRun script when key is released

Mouse events

Events triggered by mouse or similar user actions.

Applies to all HTML 5 elements:

script
script
script
##ondragover Run script when an element is dragged over a valid drag and drop targetondragstartRun script when drag operation startsondropRun script when the dragged element is being draggedonmousedownWhen Run script when mouse button is pressedonmousemoveRun script when mouse pointer movesonmouseoutRun script when the mouse pointer moves out of an element##onmouseoverscriptonmouseupscriptonmousewheelscriptonscrollscript

Multimedia events

Events triggered by media such as video, image, and audio.

Applies to all HTML 5 elements, but is most commonly used in media elements (such as audio, embed, img, object, and video):

Attributes Value Description
onclick script Run script when mouse click
ondblclick script Run the script when the mouse is double-clicked
ondrag script Run script when dragging element
ondragend script Run script when drag operation ends
ondragenter script Script that runs when an element is dragged to a valid drop target
ondragleave #script Script that runs when an element leaves a valid drag and drop target
script
script
script
script
script
script
Run script when mouse pointer moves over element
Run script when mouse button is released
Run the script when the mouse wheel is turned
Run the script when the scroll bar of the element is scrolled
Attribute Value Description
onabort script When an abort event occurs Run the script
oncanplay script Run the script when the media is able to start playing but may need to be stopped due to buffering
oncanplaythrough script Run script when the media is able to play to the end without stopping due to buffering
ondurationchange #script Run script when media length changes
onemptied script Run the script when the media resource element is suddenly empty (network error, loading error, etc.)
onended #script Run script when the medium has reached the end
onerror script Run script when an error occurs during element loading
onloadeddata script Run script when media data is loaded
onloadedmetadata script When the duration of the media element and other media data have been Run script on load
onloadstart script Run script when browser starts loading media data
onpause script Run script when media data is paused
onplay script #Run script when media data is about to start playing
onplaying script Run script when media data has started playing
onprogress script When Run the script when the browser is fetching the media data
onratechange script Run when the playback rate of the media data changes Script
onreadystatechange script Run script when ready-state changes
onseeked #script Script run when the media element's positioning attribute[1] is no longer true and positioning has ended
onseeking #script Run script when the media element's positioning attribute is true and positioning has begun
onstalled script Run script when there is an error (delay) in retrieving media data
onsuspend script Run script when the browser is already retrieving media data but stops before retrieving the entire media file
ontimeupdate script Script that runs when the media changes its playback position
onvolumechange script Run script when the media changes volume or when the volume is set to mute
onwaiting script Run script when media has stopped playing but is intended to continue playing

Other events

Attributes Value Description
onshow script Fired when the element is displayed in context
ontoggle script Triggered when the user opens or closes the
element

For more programming-related knowledge, please visit: Programming Course! !

The above is the detailed content of What event attributes does HTML have?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn