HTML5 new event Summary

Source: Internet
Author: User

Comments: HTML elements can have event attributes that trigger behavior in the browser. For example, when a user clicks an HTML element, a JavaScript code is started. The event attributes listed below can be inserted with HTML tags to define event behavior. Differences between HTML 4.01 and HTML 5 new events in HTML 5: onabort, onbeforeunload, onconte

HTML elements can have event attributes that trigger behavior in the browser. For example, when a user clicks an HTML element, a JavaScript code is started. The event attributes listed below can be inserted with HTML tags to define event behavior.

Differences between HTML 4.01 and HTML 5

New events in HTML 5: onabort, events, oncontextmenu, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onmessage, onmousewheel, onresize, onscroll, and onunload.

The HTML 4.01 attribute, which is no longer supported, is onreset.

Attribute
Attribute Value Description 4 5
Onabort Script Run the script when the abort event occurs.   5
Onbeforeonload Script Run the script before the element is loaded.   5
Onblur Script Run the script when the element loses focus. 4 5
Onchange Script Run the script when the element changes. 4 5
Onclick Script  The script is allowed when you click the mouse. 4 5
Oncontextmenu Script Run the script when the menu is triggered.   5
Ondblclick Script  Run the script when you double-click it. 4 5
Ondrag Script The script is allowed as long as it is being dragged.   5
Ondragend Script Run the script at the end of the drag operation.   5
Ondragenter Script When an element is dragged to a valid destination, the script is executed.   5
Ondragleave Script When an element leaves a valid placement target.   5
Ondragover Script Execute the script as long as the element is being dragged to a valid target.   5
Ondragstart Script Execute the script when the drag operation starts.   5
Ondrop Script Execute the script when the element is being dragged.   5
Onerror Script Execute the script when an error occurs during element loading.   5
Onfocus Script Execute the script when the element gets the focus. 4 5
Onkeydown Script  Execute the script when the button is pressed. 4 5
Onkeypress Script  Execute the script when the button is pressed. 4 5
Onkeyup Script  Execute the script when the button is released. 4 5
Onload Script Execute the script when the document is loaded. 4 5
Onmessage Script Execute the script when the message event is triggered.   5
Onmousedown Script  Execute the script when the mouse button is pressed. 4 5
Onmousemove Script  Execute the script when the mouse pointer moves. 4 5
Onmouseover Script Execute the script when you move the cursor over an element. 4 5
Onmouseout Script Execute the script when the mouse pointer removes the element. 4 5
Onmouseup Script  Execute the script when the mouse button is released. 4 5
Onmousewheel Script Execute the script when the scroll wheel is clicked.   5
Onreset Script Execute the script when the form is reset. Not supported. 4  
Onresize Script Run the script when the element is adjusted.   5
Onscroll Script Execute the script when the element scroll bar is rolled.   5
Onselect Script Execute the script when the element is selected. 4 5
Onsubmit Script Run the script when the form is submitted. 4 5
Onunload Script Run the script when the document is uninstalled.   5

Related Article

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.