Detailed description of JavaScript events

Source: Internet
Author: User

JavaScript Event List commentary on JavaScript event list
Event Browser Support Commentary
General event onclick IE3, N2 trigger this event when mouse clicks
OnDblClick IE4, N4 triggers this event when the mouse double-clicks
OnMouseDown IE4, N4 triggers this event when the mouse is pressed
OnMouseUp IE4, N4 triggers this event when you release the mouse when the mouse is pressed
onmouseover IE3, N2 triggers this event when the mouse moves over the range of an object
OnMouseMove IE4, N4 triggers this event when the mouse moves
onmouseout IE4, N3 triggers this event when the mouse leaves an object range
onkeypress IE4, N4 triggers this event when a key on the keyboard is pressed and released.
OnKeyDown IE4, N4 triggers this event when a key on the keyboard is pressed
OnKeyUp IE4, N4 triggers this event when a key on the keyboard is pressed to release
Page-related events onabort IE4, N3 images are interrupted by the user when downloading
onBeforeUnload IE4, N triggers this event when the contents of the current page are about to be changed
This event is triggered when an error occurs onerror IE4, N3
This event is triggered when the onload IE3, N2 page content finishes
This event is triggered when the window of OnMove IE, N4 browser is moved
OnResize IE4, N4 triggers this event when the browser's window size is changed
This event is triggered when the scroll bar position of the onscroll IE4, N browser is changed
OnStop IE5, N the browser's stop button is pressed when this event is triggered or the file being downloaded is interrupted
OnUnload IE3, N2 the current page will be changed when this event is triggered
This event is triggered when a form-related event onblur IE3, N2 the current element loses focus
OnChange IE3, N2 the current element loses focus and the element's content changes to trigger this event
onfocus IE3, N2 triggers this event when an element receives focus
OnReset IE4, N3 This event is triggered when the properties of reset in the form are fired
OnSubmit IE3, N2 This event is triggered when a form is submitted
This event is triggered when scrolling caption event onbounce IE4, N moves beyond the marquee display to the content within the marquee
OnFinish IE4, N fires this event when the MARQUEE element finishes what needs to be displayed
OnStart IE4, N fires this event when the MARQUEE element starts displaying content
Edit Event Onbeforecopy IE5, N triggers this event before the current selection of the page will be copied to the Clipboard of the viewer system
Onbeforecut IE5, N triggers this event when some or all of the contents of a page are moved away from the current page [clip] and moved to the viewer's system Clipboard
Onbeforeeditfocus IE5, N current element will enter edit state
This event is triggered when Onbeforepaste IE5, N content is going to be transferred from the viewer's system Clipboard [paste] to the page
onbeforeupdate IE5, N notifies the target object when the viewer pastes the contents of the system Clipboard
OnContextMenu IE5, N events triggered when the viewer presses the right mouse button to the menu, or when the page menu is triggered by a keyboard key
Oncopy IE5, N triggers this event when the current selected content of the page is copied
Oncut IE5, N triggers this event when the current selected content of the page is clipped
Ondrag IE5, N fires this event when an object is dragged [active event]
Ondragdrop IE, N4 an external object is dragged into the current window or frame by the mouse
Ondragend IE5, N triggers this event when the mouse drag is finished, that is, the mouse button is released
OnDragEnter IE5, N fires this event when an object is dragged into its container by an object that the mouse drags
OnDragLeave IE5, N fires this event when an object is dragged out of its container by an object that the mouse drags
OnDragOver IE5, N fires this event when a dragged object is dragged within the scope of another object container
Ondragstart IE4, N fires this event when an object is being dragged
OnDrop IE5, N triggers this event when the mouse button is released during a drag
Onlosecapture IE5, N triggers this event when the element loses the selection focus formed by the mouse movement
Onpaste IE5, N triggers this event when content is pasted
Onselect IE4, N events When text content is selected
Onselectstart IE4, N events triggered when text content selection will begin to occur
Data binding onafterupdate IE4, N triggers this event when data is completed by the data source to the object's transfer
Oncellchange IE5, N when the data source is changed
ondataavailable IE4, N triggers an event when data reception is complete
ondatasetchanged IE4, N events triggered when the data source has changed
ondatasetcomplete IE4, N triggers this event when all valid data for the child data source has been read
onerrorupdate IE4, N replaces onafterupdate event when data transfer is canceled with onbeforeupdate Event trigger
Onrowenter IE5, N events that are triggered when data from the current data source changes and there are new valid data
onrowexit IE5, N events that are triggered when data from the current data source is going to change
Onrowsdelete IE5, N triggers this event when the current data record is deleted
Onrowsinserted IE5, N fires this event when the current data source is about to insert a new data record
External event Onafterprint IE5, N triggers this event when the document is printed
Onbeforeprint IE5, N triggers this event when the document is about to be printed
Onfilterchange IE4, N events that are triggered when the filter effect of an object changes
OnHelp IE4, N triggers this event when the viewer presses F1 or the browser's help is selected
Onpropertychange IE5, N fires this event when one of the properties of an object has changed
onReadyStateChange IE4, N fires this event when the initialization property value of an object has changed
[Table] [/table]onactivate is triggered when the object is set to the active element.
onafterupdate fires on a data-bound object when the associated object in the data source object is successfully updated.
Onbeforedeactivate fires immediately before the activeelement changes from the current object to another object in the parent document.
onbeforeupdate fires on a data-bound object before the associated object in the data source object is successfully updated.
Onblur fires when an object loses input focus.
Oncontrolselect fires when a user is about to make a control selection on the object.
OnDeactivate fires when activeelement changes from the current object to another object in the parent document.
onerrorupdate triggers on data-bound objects when there is an error updating the associated data in the data source object.
onfocus triggers when the object gets focus.
OnLoad fires immediately after the browser finishes loading the object.
OnMove triggered when an object is moved.
Onmoveend is triggered when the object stops moving.
Onmovestart is triggered when the object starts moving.
onReadyStateChange is triggered when the object state changes.
Onresizeend triggered when the user finishes changing the dimensions of the object in the control's selected area.
Onresizestart is triggered when the user starts to change the dimensions of the object in the control's selected area.
Ontimeerror is triggered unconditionally when a specific time error occurs, usually caused by setting the property to an invalid value. :

JavaScript event concatenation method for performing multiple processing processes
When I wrote a JavaScript program, events were used
Object. event = handler;

Initialized in the same way. This is a common approach for Internet Explorer, Mozilla/firefox, and Opera. One problem, however, is that this approach can only be one event for an event-handling process. If you want an event to perform more than one process in turn, it's not working.
Internet Explorer, however, provides a attachevent method starting with 5.0, which allows you to assign multiple processes to an event. Attachevent is also available for the current Opera. But the problem is that Mozilla/firefox does not support this approach. But it supports another AddEventListener method, which is similar to attachevent and is used to assign multiple processes to an event. But there are some differences in the events they assign, in the Attachevent method, the event begins with "on", and in AddEventListener, the event does not have an "on" in the beginning, and the AddEventListener has a third parameter, which is typically specified as False to do so.
So if you want to assign more than one process to an event in your program, just start by judging the browser and then choose whether to use Attachevent or AddEventListener depending on the browser. Examples are as follows:
if (document. All) {
window. Attachevent (' onload ', handler1);
window. Attachevent (' onload ', handler2);
} else {
window. AddEventListener (' Load ', Handler1, false);
window. AddEventListener (' Load ', Handler2, false);
}

Note: The order of execution of multiple procedures assigned by attachevent is random, so there is no sequential dependency between these processes. In addition, attachevent and AddEventListener are not only applicable to window objects, but other objects also support the method.

Detailed description of JavaScript events

Related Article

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.