10. Objects and the DOM

In This Chapter

About Node Manipulation 242

Adding Nodes 244

Deleting Nodes 246

Deleting Specific Nodes 248

Inserting Nodes 251

Replacing Nodes 254

Writing Code with Object Literals 257

Node manipulation is the W3C-recommended way for standards-compliant browsers to support Web pages that act more like applications than the standard, static pages that you’re used to. For instance, you can have pages that change based on entries the user makes, without hitting the server, and you can update pages under script control. Although you can use techniques like innerHTML, as we’ve done elsewhere in this book, here we show the officially supported approach. While this can also be done on the server side, it’s only with JavaScript ...

Get JavaScript: Visual QuickStart Guide, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.