In the previous lesson, we looked at the many different things you can do with text and strings. Today we’ll focus on two different types of data:images and objects. By the end of this lesson, you’ll know how to:
- Preload images to speed up your image swaps
- Create your own objects to make big scripts comprehensible
- Use associative arrays to rapidly access all the objects in your scripts
We’ll get the ball rolling with image maps.
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.