background
|
|
Computer

Linux
Linux Support
A small area on the internet for Linux Support.
More icon
|
|
Up Image
Navigation
Search this Site
Enter your search terms

Site Breadcrumb - You are here
|
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»