O'Reilly logo

The Book of JavaScript, 2nd Edition by thau!

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What's with All the Dots?

You may wonder why JavaScript refers to my_image as window.document.my_image and not just as my_image. You may also wonder why you would use window .document.my_image.src when you want to change the src of that image. In short, what's with all the dots?

The answer has to do with how your browser looks at your web page.

Figure 4-17 shows the hierarchical organization of a web page as JavaScript understands it—through the Document Object Model (DOM). At the top of the DOM is the window that contains the web page you're view-ing. That window contains the navigator, document, and location objects. Each of these objects has a lot of information in it, and by changing one you can change what happens on your web page.

The dots ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required