Preface

Something was missing. Here I was, poring through stacks of JavaScript books and screen after screen of web sites, soaking in as much code and as many concepts as possible. But after picking up some new syntax or a slick technique from the guru de jour, I didn’t know what to do with it outside the scope of the example. It was as if I had a kitchen full of ingredients, but no recipes. I had all these cool JavaScript techniques and code snippets, but I wasn’t sure how to apply them to solve common web site problems. Sure, some of those books had JavaScript applications, but they weren’t relevant to the Web. I mean, a blackjack game is great. So is a spreadsheet app, but I’m not going to put those on a web site any time soon.

So here are some recipes. Not just for checking a browser’s identity or doing an image rollover, but full-blown applications that you’ll actually want to use on your web site. The applications here are pretty much out of the box. You can copy them into a folder on your web server (or local computer) and run them immediately. The chapters that follow are packed with JavaScript that helps you help users perform common web tasks, such as site searching, collecting survey info, creating image rollovers, viewing online presentations, cyber shopping, and plenty more. Of course, you’ll want to modify them to make them work best for you, but they’re more or less ready to go. In addition, each application comes with a lengthy explanation so that you can check out what makes each one work.

What You Should Know

This is not a beginner’s book. You will not learn JavaScript here. You will learn how to use it. You don’t have to be a three-year JavaScript veteran, but if info.replace(/</g, "&lt;"), new Image(), and var itemArray = [] seem obscure, make sure you at least have a JavaScript syntax book handy as you work. Try O’Reilly’s JavaScript: The Definitive Guide , by David Flanagan.

Get JavaScript Application Cookbook 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.