Java Reference
In-Depth Information
start in this chapter by looking at the more commonly used parts of the BOM, as shown in Figure 8-1.
These parts of the BOM are, to a certain extent, common across all browsers. Later chapters build on
this so that by the end of the topic you'll be able to really make the BOM work for you.
window object
location object
history object
document object
navigator object
screen object
forms object
images object
links object
figureĀ 8-1
The BOM has a hierarchy. At the very
top of this hierarchy is the window object.
You can think of this as representing
the frame of the browser and everything
associated with it, such as the scrollbars,
navigator bar icons, and so on.
Browser window or
frame, represented in
the BOM by the window
object
Contained inside the window frame is the
page. The page is represented in the BOM
by the document object. You can see these
two objects represented in Figure 8-2.
HTML page
represented in the BOM
by the document object
Now let's look at each of these objects in
more detail.
figureĀ 8-2
the window object
The window object represents the browser's frame or window, in which your web page is contained.
To some extent, it also represents the browser itself and includes a number of properties that are
there simply because they don't fit anywhere else. For example, via the properties of the window
object, you can find out what browser is running, the pages the user has visited, the size of the
browser window, the size of the user's screen, and much more. You can also use the window object
to access and change the text in the browser's status bar, change the page that is loaded, and even
open new windows.
The window object is a global object , which means you don't need to use its name to access its
properties and methods. In fact, the global functions and variables (the ones accessible for you
to script anywhere in a page) are all created as properties of the global object. For example, the
alert() function you have been using since the beginning of the topic is, in fact, the alert()
method of the window object. Although you have been using this simply as this:
alert("Hello!");
 
 
Search WWH ::




Custom Search