return to first page linux journal archive
keywordscontents

Book Review

JavaScript Application Cookbook

Buy this book today!

The JavaScript Application Cookbook written by Jerry Bradenbaugh and published by O'Reilly is a good resource for anyone who wants to take advantage of the power of JavaScript. Instead of providing a language tutorial or a collection of routines, the book contains fully functional JavaScript applications. Some of the applications included are a client-side search engine, a shopping cart, a context-sensitive help system, and a drag-and-drop application that lets users build their own DHTML e-mail greeting cards. The applications are fully functional and show how powerful JavaScript can be.

The application source code and images are available from O'Reilly's web site as one big Zip file. The book does contain the source code listings, but since some of them contain over 400 lines, I suggest downloading the file instead of trying to type the code from the book. While the code is not heavily commented, Mr. Bradenbaugh thoroughly explains it in the body of the book.

I downloaded the source code and ran all of the applications first on my home computer and then over the Web from my home page. All the applications run quickly within a browser and most of them load fairly quickly, even over a dial-up connection.

The book is made up of eleven chapters, each (except for one) containing one application. The chapter that does not include an application contains JavaScript routines that can be added to your existing code. Quite a few of the routines presented in this chapter are used in the other applications in the book.

All the chapters are laid out in the same way. The application features and JavaScript techniques used are stated at the beginning of the chapter, along with an overview of the application and any special browser requirements. Screen shots of the running application are also provided.

Next comes a syntax breakdown which contains a source code listing, followed by an explanation of how each section of the code works. These breakdowns are not JavaScript tutorials; instead, they show how the code interacts with the browser and explain some of the more powerful and exotic JavaScript features used by the application. Mr. Bradenbaugh's explanations are clear and concise, and he includes quite a few sidebars and web addresses for more information on complex subjects.

Each chapter ends with a section called Potential Extensions. These sections provide thoughts on how the reader can extend and modify the application that was just presented. While some code snippets are provided, the majority of the work is left to the reader to accomplish.

The book contains three appendices. The first is a JavaScript reference. The second appendix provides links to JavaScript- and web-related resources, as well as sites with applications similar to the ones presented in the book. The third appendix contains a Perl/CGI overview.

Mr. Bradenbaugh provides quite a bit of explanation and code showing how to have your code determine if it is running on a Netscape or a Microsoft browser, then run correctly when doing such things as DHTML. I tried running some of the applications on both Netscape and Microsoft browsers, and they worked correctly each time.

The book's applications demonstrate good attention to detail. Such things as positioning buttons correctly when creating a page, positioning new browser windows so that they don't completely cover existing windows, and putting search results in alphabetical order are hallmarks of polished applications.

I did not find any errors in the book, and there were no errata on O'Reilly's web site when I looked. The only thing that was not correct as stated in the book are the web addresses for Internet Explorer information. These pages were moved by Microsoft when they redesigned their site.

I found the JavaScript Application Cookbook to be a useful book, containing applications that can be used right away. The explanations and code breakdown do a very good job of illustrating the power of JavaScript. While not a JavaScript primer, the book will be useful for someone with JavaScript experience who wants to create powerful programs.

Ralph Krause is a freelance computer consultant in Michigan. His current career goal is to stay out of automotive paint shops. He can be reached via e-mail at rkrause@netperson.net.