Copyright Scriptin’ with JavaScript and Ajax: A Designer’s Guide Charles Wyke-Smith New Riders1249 Eighth StreetBerkeley, CA 94710510/524- 2178 Find us on the Web at www.newriders.com To report errors, please send a note to [email protected] New Riders is an imprint of Peachpit, a division of Pearson Education Copyright © 2010 Charles Wyke-Smith© Development Editor and Compositor: Beth BastProject Editor: Nancy PetersonTechnical Editor: Christian HeilmannProducti on Coordinator: Hilal SalaCopy Editor and Proofreader: Anne Marie WalkerMarketing Manager: Glenn BisignaniIndexer: Jo y Dean LeeCover Design: Aren HowellCover Production: Hila l SalaInterior Design: Mimi Heft Notice of Rights All rights reserved. No part of this book may be reproduced or transmitted in any form by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. For information on getting permission for reprints and excerpts, contact [email protected]. Notice of Liability The information in this book is distributed on an “As Is” basis without warranty. While every precaution has been taken in the preparation of the book, neither the author nor Peachpit shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the instructions contained in this book or by the computer software and hardware products described in it. Trademarks Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Peachpit was aware of a trademark claim, the designations appear as requested by the owner of the trademark. All other product names and services identified throughout this book are used in editorial fashion only and for the benefit of such companies with no intention of infringement of the trademark. No such use, or the use of any trade name, is intended to convey endorsement or other affiliation with this book. Technical Note: This book was produced using Adobe InDesign. Code was developed in Adobe Dreamweaver. Graphics were designed in Adobe Fireworks and Adobe Photoshop. Screenshots were taken with SnapzProX by Ambrosia Software. ISBN 13: 978-0-321-57260-8 9 8 7 6 5 4 3 2 1 Printed and bound in the United States of America Dedication For Beth Acknowledgments I want to first thank Nancy Ruenzell, Peachpit’s publisher, for the opportunity to write another book on the New Rider’s imprint, and Michael Nolan, Peachpit Acquisitions Editor, for encouraging me to complete the ...in’ trilogy. Nancy Peterson, my Project Editor, has been a wise and gracious advisor while keeping me focused on the time deadline, which I have actually met. Our weekly conference calls have been a wonderful source of guidance and encouragement, and have greatly contributed to this book’s direction and focus. To you, Nancy, my sincere thanks, and I hope we will meet in person sometime soon. Thanks go to the editorial and production team at Peachpit: to production editor Hilal Sala for her attention to the myriad details getting the pages ready to go to press, to Anne Marie Walker for her copyediting and proofing, and to Joy Dean Lee for the indexing. Several programmers have worked with me on this book. Michael Rosier assisted with the initial table of contents and some early code examples. Mark Turansky has been a valuable source of advice and ideas, and developed the framework examples in Chapter 6. Austin Markus of Ithus in San Francisco, who was the technical editor on my book Codin’ for the Web, wrote the PHP and much of the jQuery for the Author Carousel example in Chapter 7. My sincere thanks go to Chris Heilmann, International Development Evangelist for the Yahoo! Development Network and JavaScript genius. He has been invaluable as the technical editor of this book, and I am grateful to him for his detailed and always humorous feedback on the code. He also developed the YUI example in Chapter 7. I am glad that he is such a night owl because I have often been able to videoconference with him on Skype in the early hours in London where he lives to get advice when working late here in South Carolina. It has been a great experience working with Chris, and I thank him for the time he has given to this project. Special thanks goes to Scott Fegette, Technical Product Manager for Dreamweaver at Adobe, for his ongoing support and encouragement. A quick shout-out goes to David Sarnoff, Sean Rose, and Mike Harding, fellow musicians in my band Mental Note (www.mentalnoteband.com). Guys, being able to get out and play from time to time during the development of this book has helped keep me sane, and I appreciate your friendship and the time we spend making music. Once again, a big hug and a kiss for my wife Beth, who has expanded her role from my previous books to Development Editor on this one, and who has advised me on every aspect of it. She has edited the drafts of the chapters, corrected my grammar, reedited my run-on sentences (yes, still doing that), and had me rework my explanations until I produced something she could understand. She has coordinated the deliveries of the numerous rounds of chapters with the Peachpit team, developed the diagrams from my sketches, and, not least, laid out the entire book in its final form in Adobe InDesign. Thanks to you, sweetie, we did it again! To my lovely daughters, Jemma and Lucy, we once again have had less time together while I have been writing, and now it’s time for our vacation. I love you so much, appreciate your patience while I have been shut in my office writing, and look forward to enjoying the rest of the summer with you both. Finally, I want to thank you, my readers, for buying my books and for sharing your experiences using the techniques and ideas in them. I’m delighted to have finally completed this JavaScript book in response to all of you who have encouraged me to write it. —Charles Wyke-Smith Charleston, South Carolina, July 12, 2009 About the Author Charles Wyke-Smith is the author of Stylin’ with CSS: A Designer’s Guide and Codin’ for the Web: A Designer’s Guide to Developing Dynamic Web Sites. Charles has been involved in print, multimedia and Web design for over twenty years. He founded PRINTZ Electronic Design in San Francisco in the mid-eighties, an early all-computerized design studio, and was a pioneer in interactive media development. He has been creating Web sites since 1994 and has provided Web design and consulting service to companies including Wells-Fargo, Benefitfocus, ESPN Video Games, and University of California, San Francisco. His work today focuses on online application development, with an emphasis on user experience, information architecture, and interface design. An accomplished speaker and instructor, Charles has taught classes in multimedia interface design and has presented at many industry conference. He lives with his wife, Beth, and two daughters in Charleston, South Carolina. Contributors Christian Heilmann is a geek and hacker by heart. He’s been a professional Web developer for about eleven years and worked his way through several agencies up to Yahoo!, where he delivered Yahoo! Maps Europe and Yahoo! Answers. He’s written two books and contributed to three others on JavaScript, Web development, and accessibility. He managed teams in the U.S., India, and the U.K. to release dozens of online articles and hundreds of blog posts in the last few years. He’s been nominated Standards Champion of the Year 2008 by .net magazine in the UK. Currently he sports the job title International Developer Evangelist, spending his time going from conference to conference and university to university to train people on systems provided by Yahoo! and other Web companies. Austin Markus is a Web application developer and principal
Description: