beginners builders masters
 
SEARCH: webmonkey  the web

 
JavaScript
-------------------------
Print
this article for free. 
-------------------------

JavaScript Subject Index

Overview

Lesson 1

Lesson 2

Lesson 3
1  The JavaScript Document Object Model, Windows, and Frames
2 Introduction to Window Manipulation
3 Window Manipulation in JavaScript
4 Examples of Opening Windows with JavaScript
5 Windows Features
6 The JavaScript Document Object Model
7 Messing with the Status Bar
8 Communicating between Windows
9 More about the JavaScript Document Object Model
10 Messing with the DOM in other Windows
11 Getting Framed
12 More about Window and Frame Hierarchies
13 Get Your Hands Dirty
14 Lesson 3 Review

Lesson 4

Lesson 5



Thau's JavaScript Tutorial
Lesson 3

by Thau!

Page 1 — The JavaScript Document Object Model, Windows, and Frames

In earlier lessons, you've learned:
  • How to add JavaScript to your HTML pages
  • How to use dialog boxes and variables to store and utilize user input
  • How to write HTML to a Web page using JavaScript
  • How to let JavaScript make decisions using if-then statements
  • How to make your Web pages react to users' actions using link events
  • How to do a basic image swap

So far I've explained how to do many things, but I haven't described why they work. In the last lesson, for instance, I showed you that window.document.monkey_image.src = "happy_monkey.gif" will swap happy_monkey.gif into an image named monkey_image. But what is that window.document stuff? And where does the .src come from? Similarly, you've seen document.writeln("monkey"). But why is it document.writeln and not just writeln?

The answer to the above questions can be found in the JavaScript Document Object Model. The DOM is the way JavaScript describes Web pages, and it lies at the heart of all JavaScript programming. This lesson will teach you about the DOM, and the next lesson will teach you the rest of the basics of computer programming. By the end of the next two lessons, you will know all of the major ideas and syntax of JavaScript. All that will be left to learn are details, tricks, and how to avoid snafus.

To start us off along the road to the DOM, let's learn about how to use JavaScript to open and manipulate new browser windows.

next page»