On numerous online forums for JavaScript and DHTML, the majority of questions begin with "How do I...?" This new Cookbook provides the answers with a comprehensive collection of problems, solutions, and practical examples. The book's recipes range from simple tasks, such as manipulating strings and validating dates in JavaScript, to entire libraries that demonstrate complex tasks, such as cross-browser positioning of HTML elements and sorting tables.
Several bookmarks in my primary web browser link to sites that have, for years, displayed the "under construction" message and yellow-and-black "men working" road sign symbol. Ever the optimist, I keep the bookmarks alive and periodically visit the sites, looking forward to the day when the stick figure in the hard hat with the shovel leaves the scene, revealing a gleaming site containing the information that I had hoped for years ago.
This image comes to mind because my "brain browser" has maintained a bookmark to this book for years—but that stick figure kept hammering, sawing, and digging while the book remained forever "under construction." Even though client-side JavaScript has been around since late 1995, and true Dynamic HTML concepts have been within reach since 1998, the road has been a bumpy one for those trying to use (and write about) the technologies. Conflicts in document object model (DOM) implementations in various browsers, complicated by the evolution of the World Wide Web Consortium's (W3C) DOM recommendation, have made deployment of insightful client-side applications occasionally treacherous. This is especially true if the application must run on a broad range of browser brands and operating systems.
Now that the W3C DOM standard has fleshed itself out sufficiently, and other DHTML-related standards (HTML, XHTML, and Cascading Style Sheets) are largely working toward the same interoperable goals, it is finally time to apply the current state of the art to typical client-side scripting tasks. A cookbook approach lends itself nicely to provide answers to the most common question lead-in from programmers, designers, and content authors: "How do I...?"