JavaScript Event-Event type

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.