What are events in JavaScript

The concept of events


Events: refer to some specific interactive moments that occur in a document or browser window . We can schedule events through listeners (or handlers) so that the corresponding code can be executed when the event occurs.


Event handler


Event handler: Our user's click action on the page, mouse movement action, web page loading action, etc. can all be called event names, that is: onclick, mousemove, load, etc. The name of the event. The function that responds to an event is called an event handler, or an event listener.

The following is a list of attributes that can be inserted into HTML tags to define event actions.

6.png

Let’s introduce the commonly used events in detail

Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> function fun(){ window.alert("欢迎来到php.cn") } </script> </head> <body> <form> <input name="点我看看" type="button" value="点我看看" onclick="fun()"/> </form> </body> </html>
submitReset Code