HTML 4.0 event attributes

Source: Internet
Author: User
Tags list of attributes
In 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.

 

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

 

 

Attribute Definitions

Onload= Script[CT]
The OnloadEvent occurs when the user agent finishes loading a window or all frames within Frameset. This attribute may be used BodyAnd FramesetElements.
OnUnload= Script[CT]
The OnUnloadEvent occurs when the user agent removes a document from a window or frame. This attribute may be used BodyAnd FramesetElements.
Onclick= Script[CT]
The OnclickEvent occurs when the pointing device button is clicked over an element. This attribute may be used with most elements.
Ondblclick= Script[CT]
The OndblclickEvent occurs when the pointing device button is double clicked over an element. This attribute may be used with most elements.
Onmousedown= Script[CT]
The OnmousedownEvent occurs when the pointing device button is pressed over an element. This attribute may be used with most elements.
Onmouseup= Script[CT]
The OnmouseupEvent occurs when the pointing device button is released over an element. This attribute may be used with most elements.
Onmouseover= Script[CT]
The OnmouseoverEvent occurs when the pointing device is moved onto an element. This attribute may be used with most elements.
Onmousemove= Script[CT]
The OnmousemoveEvent occurs when the pointing device is moved while it is over an element. This attribute may be used with most elements.
Onmouseout= Script[CT]
The OnmouseoutEvent occurs when the pointing device is moved away from an element. This attribute may be used with most elements.
Onfocus= Script[CT]
The OnfocusEvent occurs when an element has es focus either by the pointing device or by tabbing navigation. This attribute may be used with the following elements: A, Area, Label, Input, Select, Textarea, And Button.
Onblur= Script[CT]
The OnblurEvent occurs when an element loses focus either by the pointing device or by tabbing navigation. It may be used with the same elements Onfocus.
Onkeypress= Script[CT]
The OnkeypressEvent occurs when a key is pressed and released over an element. This attribute may be used with most elements.
Onkeydown= Script[CT]
The OnkeydownEvent occurs when a key is pressed down over an element. This attribute may be used with most elements.
Onkeyup= Script[CT]
The OnkeyupEvent occurs when a key is released over an element. This attribute may be used with most elements.
Onsubmit= Script[CT]
The OnsubmitEvent occurs when a form is submitted. It only applies to FormElement.
Onreset= Script[CT]
The OnresetEvent occurs when a form is reset. It only applies to FormElement.
Onselect= Script[CT]
The OnselectEvent occurs when a user selects some text in a text field. This attribute may be used with InputAnd TextareaElements.
Onchange= Script[CT]
The OnchangeEvent occurs when a control loses the input focus AndIts value has been modified since gaining focus. This attribute applies to the following elements: Input, Select, And Textarea.

Ref:

Http://www.w3.org/TR/REC-html40/interact/scripts.html

Http://www.w3schools.com/Html/html_eventattributes.asp

Http://msdn.microsoft.com/en-us/library/ms533051.aspx

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.