Summary of JavaScript learning in March 2020

JavaScript is one of the 3 languages ​​that web developers must learn:

1. HTML defines the content of the web page
2. CSS describes the layout of the web page
3. JavaScript web page behavior

  1. ECMAscript
  2. BOM browser object model
  3. DOM document object model

HTML events
HTML events can be browser behaviors or user behaviors.
The following are examples of HTML events:

When the HTML page finishes loading
, the
HTML button is clicked when the HTML input field changes.
Usually, you can do something when an event occurs.

JavaScript can execute some code when the event is triggered.
Common HTML eventsThe
following is a list of some common HTML events:

  • onchange HTML element change/domain content change event
  • onclick the user clicks on the HTML element
  • onmouseover The user moves the mouse on an HTML element
  • onmouseout The user removes the mouse from an HTML element
  • onkeydown The user presses the keyboard key
  • onkeyup pops up after the user presses the keyboard button
  • onload browser has finished loading the page
  • onfocus Get focus event
  • onblur Loss of focus event
  • onsubmi form submission event (must use return run() to return boolean type)

You can add event attributes to HTML elements, and use JavaScript code to add HTML elements.

  1. Event handle binding method (1 is convenient for development, 2 is convenient for parameter transfer, and 3 can be multiple. The disadvantage is that it is highly mixed and not suitable for maintenance)
  2. DOM binding method (object. event attribute) (multiple anonymous functions can be used, and parameters can also be passed! Recommended!!!)

Guess you like

Origin blog.csdn.net/weixin_44177643/article/details/114371318
Recommended