About IR
Editors
Author instructions
Copyright
 
Author index
Subject index
Search
 
Reviews
 
Register
Home
 
Valid XHTML 1.0!
       

Flanagan, David. JavaScript: the definitive guide. 4th edition. Sebastopol, CA: O'Reilly & Associates Inc., . 2002. US $44.95
Heinle, Nick & Pena, Bill. Designing with JavaScript. 2nd edition. Sebastopol, CA: O'Reilly & Associates Inc., 2002. US $34.95

Introduction

JavaScript is a scripting language that enables you as a Web author to add programming commands to the HTML making up your Web pages. In client-side JavaScript (as opposed to server-side) with which the two books reviewed here are primarily concerned, these commands are downloaded along with the "normal" HTML and executed in the browser of whoever is reading your page - i.e. all the activity and interactivity brought about by your programming commands take place without the reader's browser needing to access the server again, once your page has been downloaded.

The JavaScript code that you write into your Web pages can do various things. It can take in information - i.e. be "aware" of what the reader of your Web page is doing (e.g., moving the mouse over certain areas, loading or unloading your page, or clicking a hyperlink) and of information provided by your readers (e.g., choices made in response to radio buttons or other types of form, or information typed into a text box).

JavaScript can then process this information (e.g., make calculations, check that information you have typed into a form conforms to a type of range, or perform conditional "if...then" operations to come to some decision or conclusion that can be used as the basis for customising information presentation to individual readers' requirements).

It can then generate output - responses to your readers in the form of a new Web page created "on the fly", a new Window or frame, or an "alert" box with some message. This output can incorporate your Web page's response to (i.e. the results of its processing of) the information provided by your readers. In this way, your Web pages can appear to respond intelligently to readers - for example by displaying the results of calculations or inferences it has made on the basis of their input.

JavaScript can also be used for visual effects including animations and image rollovers (e.g., buttons that change their appearance as the mouse moves over them), dropdown and tabbed menus, clocks and scrollers - and for setting up cookies that can enable you to provide customised display for each reader of your Web pages (e.g., remembering his or her name and when s/he last visited).

JavaScript: the definitive guide by David Flanagan. 4th edition. Sebastopol, CA: O'Reilly & Associates Inc., 2002. US $44.95

David Flanagan's book devotes 424 pages to an introduction to JavaScript, followed by 445 pages of reference source covering all aspects of the language. The book has a good 35 page index. A Website offers the example code for download.

Although taking up half the book, and replete with examples of code, the introduction to JavaScript is not suitable for the non-programming newcomer keen on jazzing up his or her Web pages with what is sometimes described as a simple-to-learn scripting language. It is pitched at the serious Web developer keen to add to Web pages the value that JavaScript can provide. The book is particularly suitable for two types of reader. firstly, the newcomer to JavaScript with intermediate or advanced knowledge of another programming language; secondly, the person with experience of JavaScript wishing to update his or her knowledge with recent developments, and to have the sort of complete language reference source so useful for the intermediate and advanced programmer. In the latter, the book excels.

A quick visit to Amazon.com will reveal the vast range of JavaScript books available - including the previous edition of this book. So why another - particularly a large expensive tome? Well, much has changed since in the 4 years since the 3rd edition. JavaScript has become more standardised - thus browser independent - via the appearance of version 1.5 of the language, 2nd and 3rd editions of the ECMA-262 standard to which both Netscape's JavaScript and Microsoft's JScript conform, new versions of the Explorer, Navigator and other browsers, and new versions of the W3C's Document Object Model which allows JavaScript to create and control Dynamic HTML effects.

The first parts of the book provide a comprehensive and authoritative introduction to core and client-side JavaScript. The core JavaScript section (Part I) covers lexical structure, data types and values, variables, expressions and operators, statements, functions, objects, arrays, and regular expressions. The section on client-side JavaScript (Part II) covers browsers, windows and frames, the document object, forms, cookies, the document object model, cascading style sheets, Dynamic HTML and event handling. It also includes chapters on compatibility, security and interaction with Java. The core and client-side introduction sections are mirrored by Parts III and IV which consist of reference sections relating to core and client-side JavaScript. Part V provides a reference guide to the W3C's Document Object Model. Part VI is an index of classes, properties, methods and event handlers. For the serious Web developer wanting a good book covering developments and facilities available in the most up to date version of JavaScript, and the standards with which it is designed to interact, this new edition of Flanagan's book is well worth the expense.

Designing with JavaScript by Nick Heinle and Bill Pena. 2nd edition. Sebastopol, CA: O'Reilly & Associates Inc., 2002. US $34.95

This book - from the same O'Reilly stable - is an excellent book for beginners, with a high potential interest value for intermediate JavaScript programmers. Although providing a clear and gentle introduction to the language, it does so using genuinely useful and interesting examples - including some complex applications. As with the Flanagan book, the examples of code are available for download from the O'Reilly Website. The book has 216 pages including index.

The book is very well written. Language, choice of examples, presentation and style are all highly appropriate for the newcomer to JavaScript. At the same time, the more experienced JavaScript programmer will find the examples useful. The introductory chapter concentrates on getting started quickly - and with the judicious use of colour to indicate code, sideline notes pointing out necessary detail, and shaded boxes for more detailed explanations and illustrations, it quickly entices then encourages the wary reader.

Subsequent chapters cover windows, frames, forms and form validation, arrays, browsers, dynamic images, cookies, Dynamic HTML, and advanced applications including object orientation. There are 4 appendices listing commonly used objects, event handlers, style properties, and syntax. For more detailed and complete treatment of objects and style properties, the reader is referred by the authors to Flanagan's book.

One slight annoyance. I approached with enthusiasm the section "QuickTime VR on a budget" which offers the prospect of coding a JavaScript panoramic viewer. Only 5 pages into this 7 page section did I notice the small footnote warning that the code would not work in Internet Explorer! Although the reader is referred to a subsequent chapter in which an alternative technique for obtaining browser window width (the offending piece of code) it would have been nice to be able to download a working version for Internet Explorer.

This did not significantly detract, however, from the value of this excellent introductory text. The examples given were extremely well chosen, and the book offered both explanation and downloadable code. Examples included form validation, browser detection, cookies, rollover images, a tabbed folder interface, drop-down menus, and many more.

I enjoyed this book for its clarity, and for the interest and usefulness of its examples. I would certainly recommend it to anyone starting out to learn JavaScript, as well as intermediate JavaScript programmers interested in good examples and useful code.

Nigel Ford
Department of Information Studies
University of Sheffield