How did the onclick property of the button object come from?

button.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM</title>
    </head>
    <body>
        <button id="button">this is a button</button>
    </body>
</html>
(console)button:
button.onclick = function(){
    alert("Hello World");
}
:

button?
  HTML,<button>button,
  button

buttononclick?
  (https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLButtonElement)
  HTMLButtonElementHTMLElement
  ElementNodeonclick
Jul.30,2021

The < button > tag in

HTML is implemented from DOM's HTMLButtonElement interface class , and
HTMLButtonElement inherits a series of classes from this EventTarget base class.

clipboard.png

EventTarget ""

clipboard.png


Global attribute
Global attributes



Menu