“JavaScript Phrasebook” by Christian Wenz
Developer’s Library, 2006
Developer’s Library has produced another winner in “JavaScript Phrasebook”, a book that gives you working sample code in modern JavaScript, including the basics of AJAX, in 262 pocket-sized pages including the index. If you want to learn AJAX on a cross-country flight, pack this and a laptop and you’re good to go.
Author Christian Wenz writes, “the whole hype around AJAX led to the rebirth of JavaScript.” Rebirth means it’s time to refresh your rusty JavaScript skills. Most people who have been doing Web work for a while have picked up enough JavaScript to be dangerous, so you don’t need a ground-up tutorial. But you don’t need a whole language reference or Dynamic HTML tome either. Much of the latter is probably Netscape 4.x workarounds, and the web development community by consensus has recently dropped support for that browser.
Today’s browsers are a lot easier to handle, and Wenz gives you the essentials of cross-browser compatibility to get scripting working. The good news is that JavaScript is a lot more consistent across browsers than Cascading Style Sheets is, so you’ll be able to do most of the JavaScript functionality you need without resorting to browser trickery. All the same, you are writing code to run on somebody else’s browser, and there is lots of stuff to check. Will the browser take a cookie from you? The answer is in here.
You’ll find solid implementations of all the standard JavaScript functionality here too. Validate a form, make a search box that starts with text in it but clears out the first time the user clicks on it, even pop up new windows. There is a good section on using keyboard events, so think about adding shortcuts to frequently-used applications to spare users’ carpal tunnel syndrome.
Groklaw fans and others who have followed the Eolas case will remember that post-April 2006 versions of Microsoft Internet Explorer are required to handle embedded objects differently. After you get back from the march for software patent reform, you’ll be glad to know that there is a workaround in JavaScript, so flip to page 240 and get your site’s Flash movies working again.
No matter what you’re running on the back end, today’s Web users expect a responsive interface in their browsers of choice, and the code and ideas in this book are great steps toward giving it to them.




