Supplemental files and examples for this book can be found at http://examples.oreilly.com/0790145302243-files/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Acknowledgements
Every time I write a book, I get mired in a futile attempt to thank everyone who has helped make it possible. I originally thought that I should thank everyone and their respective families in case I never wrote a book again. But now that Ive written several books, some of them twice, there seems to be less urgency to thank everyone. Its not that people need to be thanked less or that I did this all myselffar from it. But inevitably I always forget to thank someone, and though they may not be offended (who cares, its just a technology book), I still feel bad.
And yet as I sit here and write these acknowledgements, I still want to thank some people. As always, this is in no particular order and the list is incomplete. Obviously, thank you to Rebecca and Jakob and my family, who support the 16 to 20 hour days involved in getting a book written in a short time. Thanks to Russell Jones at OReilly for his editing and encouragement throughout, and thanks to Neil Salkind at Studio B as well. Thanks to Chris Tuescher, John Hein, Jeremy Guthrie, and Jim Leu, Andy Berkvam, Dan Noah, Justin Hoerter, and Mark Little. All those individuals told me that when I thank them in a book they feel compelled to buy a copy. (If it worked like that for everyone, Id go get the phone book.) While Im fishing for people to thank, I should thank Jason, Kelly, John, and Jeff as well as the web team and all my coworkers.
Thanks to brother Bob for helping me choose music to write by. Thanks as well to Jim Oliva and John Eckendorf. More than one Saturday morning was spent listening to the radio while writing, and it made working on a Saturday morning less painful. Thank you to Tim and Rob at Partners, Pat Dunn, and Dave Marie as well. Thank you to Jeff Currier for putting a door on my office.
Thank you also to the readers who sent feedback for the first edition of the book. That helped in shaping some of the areas to highlight in this second edition.
After rereading these acknowledgements, I realize I should have just thanked everyone using first names. That would give plausible deniability: Yes, when I thanked John, I really meant you and not the other one. I think there was someone else that I promised to thank, too, but I cant recall who, but thank you, too.
Introducing JavaScript Step by Step, Second Edition
Much has changed since the first edition of JavaScript Step by Step was written in 2007. The underlying JavaScript specification received a major update; Microsoft released Windows Internet Explorer 8and now 9 (which is about to be released as I write this); JavaScript development frameworks have matured and are now ubiquitous; and browsers other than Internet Explorer and Firefox, such as Safari, Chrome, and mobile browsers, became much more popular.
This second edition of JavaScript Step by Step builds on the foundation laid down by the first edition. The underlying architecture of the JavaScript language is largely the same, but its use has become pervasive, increasing hugely even in just the last three years. With that in mind, the layout and coverage of the book have also remained largely the same, with two notable exceptions: this edition places a much greater emphasis on JavaScript event handling, and it includes an entirely new section covering JavaScript libraries. Specifically, the book focuses on jQuery, which can help simplify JavaScript development, especially on large projects.
Throughout the book, youll find highlights and additions for the new features in the latest version of JavaScript. Also, the examples used in the book received greater scrutiny, in multiple browsers, to reflect the reality of todays web landscape. Reader feedback from the first edition is reflected in the content and was the impetus for adding jQuery and emphasizing event handling.
The introduction to the first edition is still relevant and applicable, and so Ive included it here.
JavaScript is an integral language for web application development, regardless of whether youre adding interactivity to a web page or creating an entire application. Todays web wouldnt be the same without JavaScript.
JavaScript is a standards-based language with a formal specification; however, as any web developer will tell you, almost every web browser interprets that specification differently, which makes web developers jobs more difficult. Fortunately, most web browsers are converging in their support and interpretation of JavaScripts core functions.
This book provides an introductory look at JavaScript, including some of its core functions as well as newer features and paradigms, such as Asynchronous JavaScript and XML (AJAX). Todays web users rely on many different platforms and many different browsers to view web content. This fact was central to development of every aspect of the book, so youll see screenshots in multiple browsers and an emphasis on standards-based, rather than proprietary, JavaScript development.