What is the use of JavaScript events?
This article will explain in detail the usefulness of the JavaScript incident for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
1. The event is triggered when the page is loaded.
2. Triggers an event when the page is closed.
3. The user clicks the button to perform the action.
4. Verify the validity of user input.
5. The HTML event occurs on HTML.
When JavaScript is used for HTML pages, JavaScript can trigger these events.
Example
Event bubbling # box1 {width: 300px; height: 300px; background-color: red;} # box2 {width: 200px; height: 200px; background-color: green } # box3 {width: 100px; height: 100px; background-color: blue } / / get all box var box1=document.getElementById ('box1'); var box2=document.getElementById (' box2'); var box3=document.getElementById ('box3') / / it is recommended to use an array of var boxs= [box1,box2,box3] for three box registration click events; for (var item0witi)