The DOM specifies:
- how browsers should create a model of an HTML page.
- how JavaScript can access and update the contents of a web page while it is in the browser window.
DOM is implemented by all major browser makers, covers two primary areas:
- Making a Model of the HTML page.(DOM tree)
- Access and changing the HTML page. (API)
Example
<html> <body> <div id="page"> <hl id="header">List</hl> <h2>Buy groceries</h2> <ul> <li id="one" class="hot"><em>fresh</em> figs</li> <li id="two" class="hot">pine nuts</li> <li id="three" class="hot">honey</li> <li id="four">balsamic vinegar</li> </ul> <script src="js/list.js "></script> </div> </body> </html>
Working with the DOM tree
时间: 2024-10-28 21:04:16