Event Attributes Reference

 <  Day Day Up  >  


In preparation for a more dynamic Web, the W3C has defined a set of core events that are associated with nearly every HTML or XHTML element. Most of these events cover simple user interaction, such as the click of a mouse button or a key being pressed. A few elements, such as form controls, have some special events associated with them. For example, form events might indicate that the field has received focus from the user or that the form was submitted. Intrinsic events, such as a document loading and unloading, are also defined. All the W3C-defined events are described in Table A-1.

Table A-1: W3C-Defined Core Events

Event attribute

Event description

onblur

Occurs when an element loses focus, meaning that the user has moved focus to another element, typically either by clicking the mouse or tabbing.

onchange

Signals that the form control has lost user focus and its value has been modified during its last access.

onclick

Indicates that the element has been clicked.

ondblclick

Indicates that the element has been double-clicked.

onfocus

Indicates that an element has received focus; namely, it has been selected for manipulation or data entry.

onkeydown

Indicates that a key is being pressed down with focus on the element.

onkeypress

Describes the event of a key being pressed and released with focus on the element.

onkeyup

Indicates that a key is being released with focus on the element.

onload

Indicates the event of a window or frame set finishing the loading of a document.

onmousedown

Indicates the press of a mouse button with focus on the element.

onmousemove

Indicates that the mouse has moved while over the element.

onmouseout

Indicates that the mouse has moved away from an element.

onmouseover

Indicates that the mouse has moved over an element.

onmouseup

Indicates the release of a mouse button with focus on the element.

onreset

Indicates that the form is being reset, possibly by the click of a reset button.

onselect

Indicates the selection of text by the user, typically by highlighting the desired text.

onsubmit

Indicates a form submission, generally by clicking a submit button.

onunload

Indicates that the browser is leaving the current document and unloading it from the window or frame.

This event model is far from complete, and it still is not fully supported by some browsers. The event model should be considered a work in progress. It will certainly change as the Document Object Model (DOM) is extended. More information about the DOM can be found at http://www.w3.org/DOM/. Already browser vendors are busy paving the way with their own events.

Extended Events

Some browsers support events other than those defined in the HTML and XHTML specifications. Microsoft, in particular, has introduced a variety of events to capture more complex mouse actions such as dragging, element events such as the bouncing of marquee text, data-binding events signaling the loading of data into an object, and fine-grain event control to catch events just before or after they happen. The basic meaning of the various extended events is briefly summarized in Table A-2.

Caution  

With events documentation, errors might exist. The event model changes rapidly , and the browser vendors have not stopped innovating in this area. Events were tested by the author for accuracy, but for the most accurate, up-to-date event model for Internet Explorer, visit http://msdn.microsoft.com/.

Table A-2: Microsoft's Extended Event Model

Event attribute

Description

onabort

Triggered by the user aborting the image load with a stop button or similar effect.

onactivate

Fires when the object is set as the active element.

onafterprint

Fires after user prints a document or previews a document for printing.

onafterupdate

Fires after the transfer of data from the element to a data provider, namely a data update.

onbeforeactivate

Fires immediately before the object is set as the active element.

onbeforecopy

Fires just before selected content is copied and placed in the user's system clipboard.

onbeforecut

Fires just before selected content is cut from the document and added to the system clipboard.

onbeforedeactivate

Fires immediately before the active element is changed from one object to another.

onbeforeeditfocus

Fires before an object contained in an editable element is focused for editing.

onbeforepaste

Fires before the selected content is pasted into a document.

onbeforeprint

Fires before the user prints a document or previews a document for printing.

onbeforeunload

Fires just prior to a document being unloaded from a window.

onbeforeupdate

Triggered before the transfer of data from the element to the data provider. Might be triggered explicitly, or by a loss of focus or a page unload forcing a data update.

onbounce

Triggered when the bouncing contents of a marquee touch one side or another.

oncontextmenu

Triggered when the user right-clicks (invokes the context menu) on an element.

oncontrolselect

Fires when the user makes a control selection of the object.

oncopy

Fires on target when selected content is pasted into a document.

oncut

Fires when selected content is cut from a document and added to the system clipboard.

ondataavailable

Fires when data arrives from data sources that transmit information asynchronously.

ondatasetchanged

Triggered when the initial data is made available from a data source or when the data changes.

ondatasetcomplete

Indicates that all the data is available from the data source.

ondeactivate

Fires when the active element is changed to another object.

ondrag

Fires continuously during a drag operation.

ondragend

Fires when the user releases during a drag operation.

ondragenter

Fires when the user drags an object onto a valid drop target.

ondragleave

Fires when the user drags the object off a valid drop target.

ondragover

Fires continuously when the object is over a valid drop target.

ondragstart

Fires when the user begins to drag a highlighted selection.

ondrop

Fires when the mouse is released during a drag-and-drop operation.

onerror

Fires when the loading of a document, particularly the execution of a script, causes an error. Used to trap runtime errors.

onerrorupdate

Fires if a data transfer has been canceled by the onbeforeupdate event handler.

onfilterchange

Fires when a page filter changes state or finishes.

onfinish

Triggered when a looping marquee finishes.

onfocusin

Fires just before an object receives focus.

onfocusout

Fires when an object is losing focus.

onhelp

Triggered when the user presses the f1 key or similar help button in the user agent.

onlayoutcomplete

Fires when the print or print preview process finishes.

onlosecapture

Fires when the object loses mouse capture.

onmouseenter

Fires when the user moves the mouse pointer into the object.

onmouseleave

Fires when the user moves the mouse pointer away from the object.

onmousewheel

Fires when the mouse scroll wheel is used.

onmove

Triggered when the user moves a window.

onmoveend

Fires when an object stops moving.

onmovestart

Fires when an object starts moving.

onpaste

Fires when selected content is pasted into a document.

onpropertychange

Fires when a property changes on an object.

onreadystatechange

Similar to onload. Fires whenever the ready state for an object has changed.

onresize

Triggered whenever an object is resized.

onresizeend

Fires when the user finishes changing the dimensions of an object.

onresizestart

Fires when the user begins to change the dimensions of an object.

onrowenter

Indicates that a bound data row has changed and new data values are available.

onrowexit

Fires just prior to a bound data-source control changing the current row.

onrowsdelete

Fires when dataset rows are about to be deleted.

onrowsinserted

Fires when dataset rows are inserted.

onscroll

Fires when a scrolling element is repositioned.

onselectionchange

Fires when the selection state of a document changes.

onselectstart

Fires when the user begins to select information by highlighting.

onstart

Fires when a looped marquee begins or starts over.

onstop

Fires when the user clicks the stop button in the browser.

ontimeerror

Fires whenever a time-specific error occurs, usually as a result of setting a property to an invalid value.



 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net