8 ENHANCING CONTENT

What this chapter covers:

  • A function that creates a list of abbreviations used in a document
  • A function that adds links to the sources of quotes in a document
  • A function that creates a list of access keys available in a document

In the last chapter, I showed that you could use the DOM to create markup on the fly. In this chapter, you're going to put those techniques into practice. You will use the DOM to create discrete chunks of markup that can be added to a web page.

What not to do

You can use JavaScript to insert content into a document. However, just because you can do something doesn't mean you should.

In theory, you could use JavaScript to add important content to a web page. That would be a very bad idea, because ...

Get DOM Scripting: Web Design with JavaScript and the Document Object Model 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.