dhtmlckbk.gifWhere, then, does the JavaScript and DHTML Cookbook fit in the pantheon of O'Reilly JavaScript books? A Cookbook, to wear the name well, should satisfy the following:

  1. It should be designed for programmers who know the target language (but perhaps only at a basic level of fluency).
  2. It should provide solid and clear recipes for commonly encountered problems.
  3. It should provide solid and clear recipes for hard problems, in a way that makes good programmers better.
  4. Ideally, it should provoke audible gasps of "Cool!"


The author of a JavaScript and DHTML cookbook is in an odd position, in that the first point can not always be assumed. Many JavaScript programmers are web designers, first and foremost, and may not understand all the ins and outs of the language. Accordingly, some of the recipes are very basic indeed, covering quite simple language features. The book does address many of the commonly encountered problems of forms validation and the like, and the simpler aspects of using the DOM and accessing style attributes, and as such may be most useful for the beginner to JavaScript and to the DOM. A reasonably decent programmer using JavaScript: The Definitive Guide will already know this material, however.

The more advanced material ranges from the interesting to the decidedly odd. An example of the latter is Goodman's attempt to build a cross-browser floating DIV-based modal popup window emulating the look and feel of the underlying OS (including titlebar and command buttons). There may be much to mine from an example like this, but the attempt is so basically misguided (making the browser mimic the OS rather than create interactions more natural to the web) that no one would or should reuse the recipe blindly. I can't say that I learned much from this book, nor did gasp "cool!" much. (I did, however, learn indirectly why getting dynamic references to element positions was breaking under Safari.)

A drawback this book shares with Goodman's other DHTML guide is its insistence and focus on compatibility with older generation browsers. To be fair, this book was written at a time when the trends towards DOM compliant (or mostly compliant) browsers were less clear. These days, only a masochist would use Netscape 4.x or IE4 browsers, and much of the traditional emphasis on supporting older browsers is pointless. Clearly, one must (unfortunately) still support IE's proprietary event model, and a small amount of feature and platform testing is important to support the minor variances between the other browsers, but most of what is covered is fortunately useless.

In sum, this book is best for a web designer who would like to add some dynamic elements to pages, but finds the JavaScript: The Definitive Guide book somewhat intimidating. For the advanced programmer who wants to learn techniques that expand the power of the browser, this is going to be down the list of books to purchase. Alas, the world is still waiting for an advanced cookbook providing Google-class recipes.