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:
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:
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:
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:
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:
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.