JS Event-Object monitoring event, event trigger function

Source: Internet
Author: User
Tags event listener

Write in front:

A sentence as the core of this article: Object monitoring event, event trigger function;

(i) Events

1. Event classification

(1) Mouse events

Click () mouse clicks

DblClick () mouse double-click

MouseOver () mouse move-in event

Mouseout () mouse out event

MouseMove () mouse Move Event

MouseDown () mouse down event

MouseUp () mouse button is released event

Scroll scrolling event (body)

(2) Keyboard events

KeyDown Keyboard Press

KeyUp keyboard Lift

(3) Touch Event

Touchstart

Touchmove

Touchend

(4) Form events

Submit a form when the user submits an event

The text of the Select text box is selected

Focus Get Spotlight Event

Blur Lost Focus Event

Change Content Changes Event

(5) Page load Complete event

Load page is finished loading

2. Monitoring Events

(1) on the HTML tag, use on to monitor

<button onclick= "Check ()" > Click Trigger Event </button>
<script type= "Text/javascript" >
function Check () {
Alert (' Hello ');
}
</script>

(2) Monitor user behavior with JavaScript

<button > Click Trigger Event </button>
<script type= "Text/javascript" >
OBTN = document.getElementsByTagName (' button ');
Obtn[0].onclick = function Check () {
Alert (' Hello ');
}
</script>

(3) Binding event listener

AddEventListener (' Event type ', event-generated behavior function, True/false)

Attachevent (' event type ', ' Event execution function ') monitors events for browsers below IE8

This part of the content is often simple, remember the commonly used on listening, remember to click the event clicked, the other routines are the same;

Replace Click on OK!

JS Event-Object monitoring event, event trigger function

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.