A brief talk on the client-side event-driven knowledge base of JavaScript

Source: Internet
Author: User
Tags knowledge base

We know that after object-oriented development, "overnight", almost all languages can be object-based, JavaScript is also object-based language. The user's behavior in the browser is called "event", followed by a series of actions, such as the window, changing the browser size, verification, Balabala, are called "event-driven." Of course, this time I'm going to introduce some of the most frequent events.

PS: For JS script support in browser and set!!! Some lower-version browsers may not support!!!

1. Click event (OnClick)

What do you mean click an event? When the user clicks the mouse button, a click event occurs. The event handler specified by the onclick will be invoked. Typically applied to buttons (Button objects), CheckBox (check box), Radio (radio button), reset buttons (reset button), submit buttons (submit button).

Enlarge The Recruit:

<! DOCTYPE html>
 
 

The effect of the following figure:

2. Change event (OnChange)

Once the user changes the value of the form, the onchange event is triggered.

The code is as follows:

<! DOCTYPE html>
 
 

The effect of the following figure:

3. Selected Events (onselect)

When an element in the page is selected, the Onselect event is triggered.

The code is as follows:

<! DOCTYPE html>
 
 

The effect of the following figure:

4. Load event (onLoad)

The Load event is the event that is triggered when the Web page is just opened.

The code is as follows:

<! DOCTYPE html>
 
 

The effect of the following figure:

5. Pre-uninstall event (Beforeunload)

Specifically, it is more appropriate to call "event before leaving Page", which triggers this event when you click the Close button on the current tab page.

The code is as follows:

<! DOCTYPE html>
 
 

The effect of the following figure:

This article on JavaScript based on the client-side event driver is a small part of the whole content to share, I hope to give you a reference, but also hope that we support the cloud-dwelling community.

Related Article

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.