Chapter 7. The Browser Environment
You know that JavaScript programs need a host environment. Most of what you learned so far in this book was related to core ECMAScript/JavaScript and can be used in many different host environments. Now, let's shift the focus to the browser, since this is the most popular and natural host environment for JavaScript programs. In this chapter, you will learn about the following elements:
- The Browser Object Model (BOM)
- The Document Object Model (DOM)
- Browser events
- The
XMLHttpRequest
object
Including JavaScript in an HTML page
To include JavaScript in an HTML page, you need to use the <script>
tag as follows:
<!DOCTYPE> <html> <head> <title>JS test</title> <script src="somefile.js"></script> </head> <body> <script>
Get JavaScript : Object-Oriented Programming 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.