XHTML Event Attributes

New to HTML 4.0 was 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, and title elements.

Attribute Value Description
onclick script  What to do on a mouse click
ondblclick script  What to do on a mouse doubleclick
onmousedown script  What to do when mouse button is pressed
onmousemove script  What to do when mouse pointer moves
onmouseover script What to do when mouse pointer moves over an element
onmouseout script What to do when mouse pointer moves out of an element
onmouseup script  What to do when mouse button is released

XHTML Standard Attributes

XHTML tags can have attributes. The special attributes for each tag are listed under each tag description. The attributes listed here are the core and language attributes that are standard for all tags (with a few exceptions).



Core Attributes

Not valid in base, head, html, meta, param, script, style, and title elements.

Attribute Value Description
class class_rule or style_rule The class of the element
id id_name A unique id for the element
style style_definition An inline style definition
title tooltip_text  A text to display in a tool tip


Language Attributes

Not valid in base, br, frame, frameset, hr, iframe, param, and script elements.

Attribute Value Description
dir ltr | rtl Sets the text direction
lang language_code Sets the language code


Keyboard Attributes

Attribute Value Description
accesskey character Sets a keyboard shortcut to access an element
tabindex number Sets the tab order of an element

XHTML Modularization

The XHTML modularization-model defines the modules of XHTML.


Why XHTML Modularization?

XHTML is a simple, but large language. XHTML contains most of the functionality a web developer will need.


For some purposes XHTML is too large and complex, and for other purposes it's too simple.

By splitting XHTML into modules, the W3C (World Wide web Consortium) has created small and well-defined sets of XHTML elements that can be used separately for small devices, or combined with other XML standards into larger and more complex applications.

With modular XHTML, designers can:

  • Choose the elements to be supported by a device using standard XHTML building blocks
  • Add extensions to XHTML, using XML, without breaking the XHTML standard
  • Simplify XHTML for devices like hand held computers, mobile phones, TV, and home appliances
  • Extend XHTML for complex applications by adding new XML functionality (like MathML, SVG, Voice and Multimedia)
  • Define XHTML profiles like XHTML Basic (a subset of XHTML for mobile devices)

XHTML Modules

W3C has split the definition of XHTML into 28 modules:

Module name Description
Applet Module Defines the deprecated* applet element
Base Module Defines the base element
Basic Forms Module Defines the basic forms elements
Basic Tables Module Defines the basic table elements
Bi-directional Text Module Defines the bdo element
Client Image Map Module Defines browser side image map elements
Edit Module Defines the editing elements del and ins
Forms Module Defines all elements used in forms
Frames Module Defines the frameset elements
Hypertext Module Defines the a element
Iframe Module Defines the iframe element
Image Module Defines the img element
Intrinsic Events Module Defines event attributes like onblur and onchange
Legacy Module Defines deprecated* elements and attributes
Link Module Defines the link element
List Module Defines the list elements ol, li, ul, dd, dt, and dl
Metainformation Module Defines the meta element
Name Identification Module Defines the deprecated* name attribute
Object Module Defines the object and param elements
Presentation Module Defines presentation elements like b and i
Scripting Module Defines the script and noscript elements
Server Image Map Module Defines server side image map elements
Structure Module Defines the elements html, head, title and body
Style Attribute Module Defines the style attribute
Style Sheet Module Defines the style element
Tables Module Defines the elements used in tables
Target Module Defines the target attribute
Text Module Defines text container elements like p and h1

* Deprecated elements should not be used in XHTML.


About US

At Blog itonlinestore.net you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, SQL, Database, Multimedia and WAP.

Recent posts

Recent comments

Archive

Search

Tags




Disclaimer

We do not warrant the correctness of its contents. The risk from using it lies entirely with the user.

© Copyright 2010