Summary

In this chapter you've learned:

  • How to trigger events, such as onMouseOver and onMouseOut

  • How to nullify a link with return false inside onClick

  • How to change the background color of a page

  • How to swap images

  • How to preload images so that they'll swap in more quickly

  • How the DOM uses dots to separate objects into hierarchies

Now that you know the basics of image swapping, you can perform lots of tricks. You can make an image vanish by swapping in one that's the same color as the page background. You can make images composed of explanatory text and place them next to the feature they describe. There's no end to the fun you can have with image swaps.

As always, we'll be revisiting many of these points in later chapters, so you'll become more and ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.