JavaScript & DHTML Cookbook
by Arien Malec, March 2005

|
|
|
As older browsers have mostly faded away, and new applications,
such as GMail and Google Maps, have shown the power in the Document
Object Model, interest in the JavaScript language has grown. The
classic JavaScript reference is JavaScript: The Definitive Guide, by
David Flanagan (also published by O'Reilly); Danny Goodman's other
book, Dynamic HTML: The Definitive Reference (again, also published by
O'Reilly), is a reasonable companion document. These two guides wear
the term "Definitive" reasonably well, although they fail to document
some of the more interesting XML and HTTP tools available in later IE,
Firefox, Safari and Opera browsers. |
| |
Where, 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:
- It should be designed for programmers who know the target
language (but perhaps only at a basic level of fluency).
- It should provide solid and clear recipes for commonly
encountered problems.
- It should provide solid and clear recipes for hard problems,
in a way that makes good programmers better.
- 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. |
| |
| |
| |
| |
| |
| |
| |