Chapter 14. Going Further with JavaScript

This final chapter covers various concepts that can help make you a better JavaScript programmer. You don’t need most of the ideas here to write functioning JavaScript programs, so don’t worry if you don’t understand them all. In fact, aside from the first section, “Putting It All Together” (which contains some good advice for beginners), you can program happily for a long time without needing the information in the other sections in this chapter. But if you want to expand your skills, this chapter can point you in the right direction.

Putting It All Together

So far in this book, you’ve seen lots of tasks that JavaScript can accomplish: form validation, image rollovers, photo galleries, user interface improvements like tabbed and accordion panels, and more. But you might be wondering, how do you put them together to work with your site? After all, once you start using JavaScript, you’ll probably want to use it to improve every page of your site. Here are some tips for how to use multiple scripts on your site.

Using External JavaScript Files

As mentioned on External JavaScript Files, external JavaScript files are an efficient way to share the same JavaScript code among Web pages. An external file makes updating your JavaScript easier—there’s just one file to edit if you need to enhance (or fix) your JavaScript code. In addition, when an external JavaScript file is downloaded, it’s stored in the browser’s cache, so it doesn’t need to be downloaded ...

Get JavaScript: The Missing Manual 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.