Chapter 4 Events

When we started out in Chapter 2, every script that we looked at would be loaded by the browser and executed right away. Since then, we’ve learned how to wait until the HTML document has finished loading before unleashing the awesome power of JavaScript. In every case, however, the script will work its magic (for instance, making the rows of your tables stripy), then fizzle out, leaving behind an enhanced—but still very static—page.

You don’t need to suffer with scripts that peak too quickly! With the simple techniques we’ll explore in this chapter, you’ll learn to take control, write scripts that last longer, and become a superstar … well, in your favorite JavaScript chat room, anyway.

Don’t get me wrong—scripts that ...

Get Simply JavaScript 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.