Chapter 9. Using the document and body Objects

Using the document and body Objects

In this chapter, we’ll take a look at the JavaScript properties, methods, and events of the document object and the <BODY> element. In the early days of JavaScript, before each element became a JavaScript object, the document object gave you access to many aspects of what’s really the <BODY> element—for example, the colors used in the web page. And when you’re writing to a web page, you’re really writing to the <BODY> element. Because JavaScript programmers needed access to more than just the <BODY> element, the document object grew—for example, this object also has a title property that gives you ...

Get Inside JavaScript 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.