Datasheet
Chapter 1: Introduction to JavaScript
9
< html >
< body >
< script type=”text/javascript” >
document.body.style.backgroundColor = ‘green’;
< /script >
< /body >
< /html >
You can see this rendered in Internet Explorer in Figure 1 - 2.
Figure 1-2
The Browser Object Model (BOM)
JavaScript in a browser is essentially a group of object models relating to specific areas of functionality
within the browser. One of these is known as the BOM (Browser Object Model), which represents the
browser itself. The browser object can be accessed by referencing the top - level object
window . From here
you can access things such as the
document object, the frames collection, the browser history, the status
bar, and so on. In large part, what you find in the BOM depends on what browser you are operating in.
However, the main pieces can be seen in Figure 1 - 3.
CH001.indd 9CH001.indd 9 6/25/09 7:53:17 PM6/25/09 7:53:17 PM