JavaScript is an object-based language. One of its most basic features is event-driven. Events are signals generated when some actions occur. These events can occur at any time. The action that causes the event is called a trigger event. For example, when the mouse pointer goes through a button, the user clicks... SyntaxHighlighter. all ();
JavaScript is an object-based language. One of its most basic features is event-driven. Events are signals generated when some actions occur. These events can occur at any time. The action that causes the event is called a trigger event. For example, when the mouse pointer goes through a button, the user clicks a link, the user selects a check box, and the user inputs certain information in the text box, events are triggered.
To help readers find common events in JavaScript, the following describes events in a table, as shown in table 9.3.
Table 9.3 common events in JavaScript: www.2cto.com
| Status |
Event |
Description |
| Form-related events |
Onblur |
This event is triggered when the current element loses focus. |
| Onchange |
This event is triggered when the current element loses focus and the element content changes. |
| Onfocus |
This event is triggered when an element gets focus |
| Onreset |
This event is triggered when the reset attribute in the form is activated. |
| Onsubmit |
This event is triggered when a form is submitted. |
| Rolling subtitle events |
Onbounce |
Content in Marquee is moved to the Marquee display range This event is triggered |
| Onfinish |
This event is triggered when the Marquee element completes the content to be displayed. |
| Onstart |
This event is triggered when the Marquee element begins to display content |
Continue table
| Status |
Event |
Description |
| Mouse and keyboard events |
Onclick |
This event is triggered when you click the mouse. |
| Ondblclick |
This event is triggered when you double-click the mouse. |
| Onmousedown |
Trigger this event when you press the mouse |
| Onmouseup |
This event is triggered when you press the mouse and release the mouse. |
| Onmouseover |
This event is triggered when you move the cursor over an object range. |
| Onmousemove |
This event is triggered when you move the mouse. |
| Onmouseout |
This event is triggered when the mouse leaves an object range. |
| Onkeypress |
This event is triggered when a key on the keyboard is pressed and released |
| Onkeydown |
This event is triggered when a button on the keyboard is pressed. |
| Onkeyup |
This event is triggered when a key on the keyboard is pressed and released. |
| Page related events |
Onabort |
This event is triggered when an image is interrupted during download. |
| Onload |
This event is triggered when the page content is complete (that is, the page loading event) |
| Onresize |
This event is triggered when the browser window size is changed |
| Onunload |
This event is triggered when the current page is changed |
FF: Firefox, N: Netscape, IE: Internet Explorer
| Attribute |
This event occurs when the following conditions occur: |
FF |
N |
IE |
| Onabort |
Image loading interrupted |
1 |
3 |
4 |
| Onblur |
Element loses focus |
1 |
2 |
3 |
| Onchange |
User changes domain content |
1 |
2 |
3 |
| Onclick |
Click an object |
1 |
2 |
3 |
| Ondblclick |
Double-click an object |
1 |
4 |
4 |
| Onerror |
An error occurs when a document or image is loaded. |
1 |
3 |
4 |
| Onfocus |
Element focus |
1 |
2 |
3 |
| Onkeydown |
The key of a keyboard is pressed. |
1 |
4 |
3 |
| Onkeypress |
The key of a keyboard is pressed or pressed |
1 |
4 |
3 |
| Onkeyup |
The key of a keyboard is released. |
1 |
4 |
3 |
| Onload |
A page or image is loaded |
1 |
2 |
3 |
| Onmousedown |
A mouse button is pressed |
1 |
4 |
4 |
| Onmousemove |
Move the mouse |
1 |
6 |
3 |
| Onmouseout |
Move the mouse away from an element |
1 |
4 |
4 |
| Onmouseover |
Move the mouse over an element |
1 |
2 |
3 |
| Onmouseup |
A mouse button is released |
1 |
4 |
4 |
| Onreset |
Reset button clicked |
1 |
3 |
4 |
| Onresize |
Window or frame size adjusted |
1 |
4 |
4 |
| Onselect |
Text selected |
1 |
2 |
3 |
| Onsubmit |
The submit button is clicked. |
1 |
2 |
3 |
| Onunload |
User exit page |
1 |
2 |
3 |
From tu jiankai's column