I. Common event types
1. Mouse events
Event name |
Description |
OnClick |
Trigger when mouse clicks |
Ondbclick |
Trigger when mouse double-click |
OnMouseDown |
Triggered when the left mouse button is pressed |
OnMouseUp |
Triggered when Mouse is released |
onmouseover |
triggered when the mouse cursor moves over an object |
OnMouseMove |
Trigger when mouse moves |
onmouseout |
Triggers when the mouse cursor leaves an object |
PS: When the left mouse button is clicked, the onclick, onmousedown, onmouseup three events are triggered simultaneously, and the event handler executes in order of:onmousedown>onmouseup> OnClick. Because the action that is generated by the mouse is definitely before the mouse is released, and once pressed plus one release, it represents a single click, so the onclick is finally executed.
2. Keyboard Events
Event name |
Description |
onkeypress |
Trigger after a key is pressed |
OnKeyDown |
Triggered when a key is pressed |
OnKeyUp |
Triggered when a key is released |
PS: The operation on the keyboard also triggers these three events, and the order in which the handlers are executed is onkeydown>onkeypress>onkeyup. Reason See mouse events.
3. Page Events
Event name |
Description |
OnError |
triggered when a page error occurs |
OnLoad |
triggered when page load is complete |
OnResize |
browser window size when the table is triggered |
Onscroll |
triggered when the position of the browser scroll bar is changed |
OnUnload |
Triggered when the page is unloaded |
4. Form Events
event name |
description |
onblur |
element loses focus when |
onchange |
|
onfocus when the element loses focus and the element content changes |
element triggers when focus is received |
onsubmit |
trigger when a form is submitted |
Second, JavaScript Ajax summary
1. Create a Xhr object
Method |
Description |
New ActiveXObject ("Microsoft.XMLHTTP") |
Applies to I support window. ActiveXObject's IE5 and IE6, etc. |
New XMLHttpRequest () |
Suitable for Ie7+/ff/chrome/safari/opera, etc. |
2. Properties and methods of XHR objects
Property or method |
Description |
ReadyState |
Communication status, value 0~4, see the following text |
onReadyStateChange |
This event is triggered when the readystate changes |
ResponseText |
Text Format document returned by the server |
Responsexml |
XML format documents returned by the server |
Status |
Status codes, such as 100,200,404,500 |
StatusText |
Text corresponding to the status code (Ok/not Found) |
Abort () |
Abort the current request |
Open (Method,url) |
Open a request |
Send (args) |
Send Request |
setRequestHeader (Key,value) |
Set the requested header |
getResponseHeader (Key) |
Gets the header value of the response |
getAllResponseHeaders () |
Returns all header information as a key-value pair |
3. ReadyState Properties
Code |
Description |
0 |
Represents an uninitialized state. To create an uninitialized XHR object |
1 |
Represents the connection status. The open method has been called, ready to send the request |
2 |
Represents the Send status. The Send method has been called and the response data has not been received |
3 |
Represents the receiving State, has received header information for the HTTP response, and is receiving the response content |
4 |
Represents the loaded state, when the response has been fully received |
Original starting: http://www.ido321.com/1327.html
Next: Dom Notes (vi): How do I do a jquery extension?
Dom Note (v): Common JavaScript events and Ajax summaries