Event handling for JavaScript

Source: Internet
Author: User

event handling for JavaScript

1. Event handling

A) JavaScript is an object-and event-driven scripting language

b) When the state of an object changes, the object responds to this change

c) function Funname ([Param[,para ...])

2. Mouse Events - mouse state changes

A) onclick Click event

b) Ondbclick Double-click event

c) onmouseover mouse over the event above the object

d) onmouseout mouse Leave event

e) onmousedown mouse down event

f) onmouseup Mouse release key event

g) onselect selected Events

3. Keyboard events

A) onkeydown key event - triggered when the keyboard is pressed; pressing any key will trigger

b) onkeypress Press the key event - triggered when the keyboard is pressed; occurs after onkeydown; just press the next keyword (Letters, numbers ), excluding function keys ( f1-f12),Ctrl key,Shift key,Alt key, and so on.

c) onkeyup release key event

4.HTML Events

A) OnLoad window Load event -- in page content (Pictures, plugins, controls ...) ) to be executed after the download is complete; typically added in the <body> tab

b) onunload window departure event - - window departure behavior including close, return, refresh, enter address, etc.

c) onresize events triggered by changing the window's large hours -- Specify event handlers in <body>

d) onabort Interrupt Event -triggered only when an interrupt occurs during page loading of an img image element;<img name=" Imgname "src=" "onabort=" Aborthandle () "/>

e) OnError exception event --window object's properties,window.onerror; contains 3 Default parameters: Error message, error page URL, error line number, or add "return True" to the event handler statement if you do not need a system popup error message; "

f) onreset Press the reset button event

g) OnSubmit Press the Submit button event - The handler function must return true/false, or the function body will be ignored; onsubmit='return function() ' "

5. Change Event --change of state caused by change of cursor position

A) onblur loss of focus events - such as validity of the validation date

b) Onfouse get focus events - input box style changes when entering information;onblur,onfouse are often used in conjunction

C) event triggered when onchange value is changed - - triggered only when the value of the event object has changed and the event object loses focus;onchange <select name="" onchange= "Changehandle () to listen to the user's choice to modify the drop-down list ></select>

Event handling 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.