XHTML Beginner Tutorial: XHTML Event Properties

Source: Internet
Author: User
Tags list of attributes new features valid
xhtml| Beginners | tutorials

One of the new features of HTML 4.0 is to cause HTML events to trigger behavior in the browser, for example, when a user clicks on an HTML element to start a JavaScript. Here is a list of attributes that can be inserted into an HTML tag to define event behavior.

If you want to learn how to use these events for programming, then you should learn our JavaScript tutorials and DHTML tutorials.

Window event (Windows events)

Valid only in the body and frameset elements.

Property value Description
OnLoad Script Execute script when document is loaded
OnUnload Script Execute script when document is unloaded

Form element events (form element events)

Valid only on form elements.

Property value Description
OnChange Script Execute script when element changes
OnSubmit Script Execute script when form is submitted
OnReset Script Execute script when form is reset
Onselect Script Execute script when element is selected
Onblur Script Execute script when element loses focus
onfocus Script Execute script when element gets focus

Keyboard event (keyboard events)

is invalid in the following elements: base, BDO, BR, Frame, frameset, head, HTML, iframe, Meta, param, script, style, and title elements.

Property value Description
OnKeyDown Script Execute script when the keyboard is pressed
onkeypress Script Execute script when the keyboard is pressed and released
OnKeyUp Script Execute script when keyboard is released

Mouse event (keyboard events)

is invalid in the following elements: base, BDO, BR, Frame, frameset, head, HTML, iframe, Meta, param, script, style, title elements.

Property value Description
OnClick Script Execute script when the mouse is clicked
OnDblClick Script Execute script when mouse is double-clicked
OnMouseDown Script Execute script when mouse button is released
OnMouseMove Script Execute script when mouse pointer moves
onmouseout Script Executes a script when the mouse pointer moves out of an element
onmouseover Script Executes a script when the mouse pointer hovers over an element
OnMouseUp Script Execute script when mouse button is released


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.