Common events and Ajax summaries for JavaScript

Source: Internet
Author: User

One, common event Type 1, mouse event event name Description onclick mouse click Trigger Ondbclick mouse double-clicked when triggered onmousedown mouse left button press when triggered onmouseup mouse release onmouseover when the mouse cursor is moved to an object, triggering onmousemove when the mouse moves onmouseout trigger PS when the mouse cursor leaves an object: When the left mouse button is clicked, the onclick, onmousedown, OnMouseUp three events, the sequence of event handlers executed is: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 event event name Description onkeypress A key pressed after the trigger onkeydown a key is pressed onkeyup trigger PS when a key is released: the operation of the keyboard will also trigger these three events, its handler execution sequence is onkeydown >onkeypress>onkeyup. See mouse events for reasons. 3, the Page event event name Description onerror page error when triggered when the onload page loading completed when the OnResize browser window size changes triggered when the Onscroll browser scroll bar changes when the position of the trigger OnUnload page will be unloaded when the triggering of the 4, form event Event name Description onblur element loses focus when trigger onchange element loses focus and element content changes when trigger onfocus element gets focus when trigger onsubmit form is submitted when trigger second, JavaScript Ajax summary 1. Creating a Xhr Object method description New ActiveXObject ("Microsoft.XMLHTTP") applies to I support window. ActiveXObject IE5 and IE6 etc. new XMLHttpRequest () for Ie7+/ff/chrome/safari/opera et 2, XHR Object properties and Method properties or method description readystate communication status, value 0 ~ ~, see the following text onreadystatechangereadystate change when this event is triggered responsetext the server returns a textual format document Responsexml the server returns the XML format of the document status code, such as 100, 200,404,500 and other statUstext Status code corresponding text (Ok/not Found) abort () abort the current request open (Method,url) opens 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 in the form of a key-value pair 3, readystate Property Code Description 0 represents an uninitialized state. To create an uninitialized XHR object 1 represents the connection state. The open method has been called, ready to send request 2 for Send status. The Send method has been called, the response data 3 represents the receiving State, the header information for the HTTP response has been received, the receiving response content 4 represents the loaded state, at which time the response has been fully received

Common events and Ajax summaries for JavaScript

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.