There are many types of events that can occur in a browser, and these types of events have different information in addition to some unified information.
User Interface Events
A user interface (UI event) is actually a variety of resources that can be seen or not seen on a Web page, and user-interface events can be triggered by actions that might be useful or triggered by the browser itself. Resources such as patterns, stylesheets, scripts, videos, audio, Ajax, and so on, can trigger user interface events.
The load () event and the error ( ) event, if the load succeeds, triggers the load () method, and if the load fails, the error () method is triggered.
var img = document.createelement ("img"); Img.addeventlistener ("load",function() { Console.log ("load succeeded");}) var img2 = document.createelement ("img"); Img2.addeventlistener ("error",function() { Console.log ("Load Failed"= "01.jpg"= "02.jpg";
Once the SRC attribute of the IMG object is set, the load () and the error (0 method are called instead of waiting until the picture is loaded into the page.
Resize () event, resize () event is triggered when the browser window size is changed
JavaScript Event-Event type