HTML 4.0 Event Attributes
New to HTML 4.0 is the ability to let HTML events 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.
Window Events
Only valid in body and frameset elements.
| Attribute |
Value |
Description |
| onload |
script |
Script to be run when a document loads
|
| onunload |
script |
Script to be run when a document unloads
|
Form Element Events
Only valid in form elements.
| Attribute |
Value |
Description |
| onchange |
script |
Script to be run when the element changes
|
| onsubmit |
script |
Script to be run when the form is submitted
|
| onreset |
script |
Script to be run when the form is reset
|
| onselect |
script |
Script to be run when the element is selected
|
| onblur |
script |
Script to be run when the element loses focus
|
| onfocus |
script |
Script to be run when the element gets focus |
Keyboard Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.
| Attribute |
Value |
Description |
| onkeydown |
script |
What to do when key is pressed |
| onkeypress |
script |
What to do when key is pressed and released |
| onkeyup |
script |
What to do when key is released |
Mouse Events
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title elements.
| Attribute |
Value |
Description |
| onclick |
script |
What to do on a mouse click
|
| ondblclick |
script |
What to do on a mouse double-click
|
| onmousedown |
script |
What to do when mouse button is pressed
|
| onmousemove |
script |
What to do when mouse pointer moves
|
| onmouseout |
script |
What to do when mouse pointer moves out of an element
|
| onmouseover |
script |
What to do when mouse pointer moves over an
element
|
| onmouseup |
script |
What to do when mouse button is released
|
Unlimited Disk and Transfer Hosting - New from Go Daddy!
Go Daddy Unlimited Hosting is the reliable, cost-effective
choice for site owners who want superior speed and reliability.
Available for Linux or Windows, our Unlimited Hosting accounts
come with unlimited disk space and bandwidth, 1,000 email
accounts, 50 MySQL Databases, a FREE SSL Certificate and over
50 FREE downloadable applications and utilities available through
our exclusive Hosting Connections. Count on the world’s largest
hostname provider to keep your site up and running—even when you’re not!
Take the uncertainty out of Web hosting and let GoDaddy.com
put service, performance and value back in. No matter which
hosting type or plan you choose, your site receives 24/7
maintenance and protection in our world-class data center.
Virtual Dedicated, Dedicated Server and unlimited plans also available.
Save 10% on web hosting - Enter code w3tenoff at checkout
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
|
|