[Front-end] DOM

What is a dom

DOM Document Object Model is the acronym translated document object model is available to the Javascript used to dynamically modify the document states.

Two common properties dom

  • innerHTML innerHTML to modify (Get) HTML elements (e.g., div) content html format. It includes html tags.
  • innerText does not include the html tags
  • It can be used to modify the value (acquires) the content of the element values ​​or attribute value of the input and textarea;

Dom three common methods of operation

  • document.getElementById ( 'id attribute value') returns the first object has a reference to the specified id
  • document.createElement ( 'element name') to create a new element node

Four common event dom

  • Click onclick event
  • Into the onload event
  • Listen for change events onchange
  • Move the mouse pointer onmouseover
  • The mouse pointer leaves the element onmouseout
  • Hold down the mouse does not release event onmousedown
  • Hold down the mouse release events onmouseup

Guess you like

Origin blog.csdn.net/cheidou123/article/details/93247884