Wow – you made it to the last and final lesson! Stunning. As a reward for all your hard work, I’ve made this lesson extremely relaxing – no nitty-gritty code to wrap your mind around and no hairy homework, just coding theory and pointers to resources.
The topics for the day are:
- Debugging techniques
Ready? It’s time to learn the fundamentals of computer programming. First stop, variables.
In earlier lessons, you’ve learned:
- How to use dialog boxes and variables to store and utilize user input
- 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
Let’s start with loops.
Now that you’ve mastered the basics of computer programming, it’s time to refocus on the Document Object Model (DOM). We’ve already seen that the DOM hierarchy starts with a Window object. Inside each Window object is a Document object. We’ll be spending this lesson going through the Document object and seeing how it can be used to get all kinds of information from your users and to dynamically present new information.