In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "what are the event attributes of HTML". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "what are the event attributes of HTML" can help you solve the problem.
Global event Properties
One of the new features of HTML 4 is the ability to enable HTML events to trigger behavior in the browser, such as launching a JavaScript when a user clicks on a HTML element.
The following table provides standard event attributes that can be inserted into HTML/XHTML elements to define event behavior.
New: a new property event is added to HTML5.
Window event property (Window Event Attributes)
The event is triggered by the window (for tags):
Attribute value description
OnafterprintNewscript runs the script after printing the document
OnbeforeprintNewscript runs the script before the document is printed
OnbeforeonloadNewscript runs the script before the document loads
Onblur script runs the script when the window loses focus
OnerrorNewscript runs the script when an error occurs
Onfocus script runs the script when the window gets focus
OnhaschangeNewscript runs the script when the document changes
Onload script runs scripts when the document is loaded
OnmessageNewscript runs a script when a message is triggered
OnofflineNewscript runs scripts when the document is offline
OnonlineNewscript runs scripts when the document is online
OnpagehideNewscript runs the script when the window is hidden
OnpageshowNewscript runs the script when the window is visible
OnpopstateNewscript runs the script when the window history changes
OnredoNewscript runs the script when the document performs a redo
OnresizeNewscript runs the script when resizing the window
OnstorageNewscript runs the script when the Web Storage area is updated (when the data in the storage space changes)
OnundoNewscript runs the script when the document executes undo
OnunloadNewscript runs the script when the user leaves the document
Form event (Form Events)
The form event is triggered in the HTML form (applies to all HTML elements, but the HTML element needs to be within the form form):
Attribute value description
Onblur script runs the script when the element loses focus
Onchange script runs the script when the element changes
OncontextmenuNewscript runs the script when the context menu is triggered
Onfocus script runs the script when the element gets focus
OnformchangeNewscript runs the script when the form changes
OnforminputNewscript runs the script when the form gets user input
OninputNewscript runs the script when the element gets user input
OninvalidNewscript runs the script when the element is invalid
Onreset script runs the script when the form is reset. HTML 5 is not supported.
Onselect script runs the script when the element is selected
Onsubmit script runs the script when the form is submitted
Keyboard event (Keyboard Events)
Attribute value description
Onkeydown script runs the script when the key is pressed
Onkeypress script runs the script when the key is pressed and released
Onkeyup script runs the script when the button is released
Mouse event (Mouse Events)
Events triggered by the mouse are similar to the behavior of the user:
Attribute value description
Onclick script runs the script when you click the mouse
Ondblclick script runs the script when you double-click the mouse
OndragNewscript runs a script when dragging an element
OndragendNewscript runs the script when the drag operation ends
OndragenterNewscript runs the script when the element is dragged to a valid drag and drop target
OndragleaveNewscript runs the script when the element leaves a valid drag-and-drop target
OndragoverNewscript runs the script when the element is dragged over a valid drag-and-drop target
OndragstartNewscript runs the script when the drag operation starts
OndropNewscript runs the script when the dragged element is being dragged and dropped
Onmousedown script runs the script when the mouse button is pressed
Onmousemove script runs the script when the mouse pointer moves
Onmouseout script runs the script when the mouse pointer moves out of the element
Onmouseover script runs the script when the mouse pointer moves over the element
Onmouseup script runs the script when the mouse button is released
OnmousewheelNewscript runs the script when the mouse wheel is turned
OnscrollNewscript runs the script when scrolling the element's scroll bar
Multimedia events (Media Events)
This event is triggered by video (videos), image (images) or audio (audio), which is often applied to HTML media elements such as,
, and):
Attribute value description
Onabort script runs the script when an abort event occurs
OncanplayNewscript runs the script when the media can start playing but may need to be stopped because of buffering
OncanplaythroughNewscript runs the script when the media can be played to the end without being buffered
OndurationchangeNewscript runs the script when the media length changes
OnemptiedNewscript runs scripts when the media resource element is suddenly empty (network error, load error, etc.)
OnendedNewscript runs the script when the media has reached the end
OnerrorNewscript runs the script when an error occurs during element loading
OnloadeddataNewscript runs scripts when loading media data
OnloadedmetadataNewscript runs the script when the duration of the media element and other media data have been loaded
OnloadstartNewscript runs a script when the browser starts to load media data
OnpauseNewscript runs scripts when media data is paused
OnplayNewscript runs the script when the media data is about to start playing
OnplayingNewscript runs the script when the media data has started playing
OnprogressNewscript runs a script when the browser is fetching media data
OnratechangeNewscript runs a script when the playback rate of media data changes
OnreadystatechangeNewscript runs scripts when the ready state (ready-state) changes
OnseekedNewscript runs the script when the positioning attribute [1] of the media element is no longer true and the positioning has ended
OnseekingNewscript runs the script when the positioning attribute of the media element is true and the positioning has started
OnstalledNewscript runs the script when there is an error (delay) in the process of retrieving media data
OnsuspendNewscript runs the script when the browser has fetched the media data but stopped before retrieving the entire media file
OntimeupdateNewscript runs a script when the media changes its playback position
OnvolumechangeNewscript runs the script when the media changes the volume or when the volume is set to mute
OnwaitingNewscript runs the script when the media has stopped playing but is ready to continue playing
Other events
Attribute value description
OnshowNewscript triggers when an element is displayed in context
OntoggleNewscript triggers when a user opens or closes an element
This is the end of the content about "what are the event properties of HTML". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.