first, the DOM model
1. Introduction
DOM Model: Document Object model.
When the DOM is created: when the page is loaded, the browser creates the Document object model of the page.
1. Use
Through the DOM model, users can modify HTML element attributes and styles, add or subtract HTML elements, and respond to HTML element events.
second, commonly used JS dom function
1. Output stream: document.write (), dynamically create page output content.
2. Change the label content: document.getElementById ("id"). innerhtml= "";
3. Change the attribute: document.getElementById ("id"). src|href|title|..| ="";
4. Change the CSS style: document.getElementById ("id"). style.width|height|color|backgoundcolor= "";
5. Common Events
1) Click event: OnClick ()
2) Page Load event: onload () and onunload ()
3) Content Changes event: Change ()
4) Spotlight Event: onfocus ()
5) Mouse events: onmouseover (), onmouseout (), onmousedown (), onmouseup ()
6) Other events: ...
In fact, there are a lot of such events, you can refer to the JS DOM event table, which is a common part of the event.
Iii. Modifying properties and styling examples
JS (quad) DOM model attribute style