W3Schools

home HOME

HTML 5 Reference

HTML 5 by Alphabet
HTML Attributes
HTML Events

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Forum

Helping W3Schools

HTML 5 Event Attributes

Previous Next

HTML elements can have event attributes that trigger actions in the browser, like starting a JavaScript when a user clicks on an HTML element. Below is a list of attributes that can be inserted into HTML tags to define event actions.

If you want to learn more about programming with these events, you should study our JavaScript tutorial and our DHTML tutorial.


Differences Between HTML 4.01 and HTML 5

New event attributes in HTML 5: onabort, onbeforeunload, oncontextmenu, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onmessage, onmousewheel, onresize, onscroll, onunload

HTML 4.01 event attributes which are no longer supported: onreset


Event Attributes

  • 4: indicates if the attribute is defined in HTML 4.01
  • 5: indicates if the attribute is defined in HTML 5
Attribute Value Description 4 5
onabort script  Script to be run at an abort event   5
onbeforeonload script  Script to be run before an element is loaded   5
onblur script  Script to be run when the element loses focus 4 5
onchange script Script to be run when the element changes 4 5
onclick script  Script to be run at a a mouse click 4 5
oncontextmenu script  Script to be run when a context menu is triggered   5
ondblclick script  Script to be run at a mouse doubleclick 4 5
ondrag script  Script to be run as long as an element is being dragged   5
ondragend script  Script to be run at the end of a drag operation   5
ondragenter script  Script to be run when the element has been dragged to a valid drop target   5
ondragleave script  Script to be run when the element leaves a valid drop target   5
ondragover script  Script to be run as long as the element is being dragged over a valid drop target   5
ondragstart script  Script to be run at the start of a drag operation   5
ondrop script  Script to be run when dragged element is being dropped   5
onerror script  Script to be run when an error occur during the loading of the element   5
onfocus script  Script to be run when the element gets focus 4 5
onkeydown script  Script to be run when key is pressed 4 5
onkeypress script  Script to be run when key is pressed and released 4 5
onkeyup script  Script to be run when key is released 4 5
onload script Script to be run when a document loads 4 5
onmessage script  Script to be run when the message event is being triggered   5
onmousedown script  Script to be run when a mouse button is pressed 4 5
onmousemove script  Script to be run when the mouse pointer moves 4 5
onmouseover script Script to be run when the mouse pointer moves over an element 4 5
onmouseout script Script to be run when the mouse pointer moves out of an element 4 5
onmouseup script  Script to be run when a mouse button is released 4 5
onmousewheel script  Script to be run when the mouse wheel is being rotated   5
onreset script  Script to be run when the form is reset.
Not supported.
4  
onresize script  Script to be run when the element is being resized   5
onscroll script  Script to be run when the elements scrollbar is being scrolled   5
onselect script  Script to be run when the element is selected 4 5
onsubmit script Script to be run when the form is submitted 4 5
onunload script Script to be run when a document unloads   5


Previous Next



Ektron
Ektron

The Ektron Intranet lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.

What can you do with the Ektron Intranet?

Ektron

Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search

Ektron

Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform

Ektron

Promote collaboration among coworkers in your organization through project workspaces where others can efficiently find information and work together

Ektron

Personalize your company profile by bookmarking and organizing favorite content, uploading assets, posting photos, blogging, and more

Ektron

Interact with features like tagging, flagging, wikis and ratings found in the Web 2.0 Toolbox

Ektron

Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management

See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today.




Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999
SITE SEARCH
 
About W3Schools
W3Schools Forum
dotnetbutton
Dynamic button image generation
WEB HOSTING
$15 Domain Name
Registration
Save $20 / year!
UK Domain Names
UK Web Hosting

Alojamiento Web
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
Domain Name Registration
PHP MySQL Hosting
Top 10 Web Hosting
Web Hosting Providers
Web Hosting Company
UK Web Hosting
UK Reseller Hosting
Web Hosting
WEB BUILDING
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Ecommerce Software
Edit XML with XMLSpy®
Azbuz Blog
SHOPPING
UK Wholesalers
UK Wholesale
UAE Dubai Property
Private Student Loans
UK Dropshippers & Wholesalers Directory
EDUCATION
US Web Design Schools
HTML Exam
YELLOW PAGES
www.nettkatalogen.no
www.gulex.dk
www.gulex.se
www.gelbex.de
www.teloos.fi
www.teloos.fr
www.teloos.co.uk
www.teloos.at
www.teloos.de