Copyright 2012 by The McGraw-Hill Companies. All rights reserved. Printed in the United States of America. Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication.
ISBN: 978-0-07-174121-7
MHID: 0-07-174121-6
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-174120-0, MHID: 0-07-174120-8.
McGraw-Hill, the McGraw-Hill Publishing logo, The Complete Reference, and related trade dress are trademarks or registered trademarks of The McGraw-Hill Companies and/or its affiliates in the United States and other countries and may not be used without written permission. All other trademarks are the property of their respective owners. The McGraw-Hill Companies is not associated with any product or vendor mentioned in this book.
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at bulksales@mcgraw-hill.com.
Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (McGraw-Hill) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
About the Authors
Thomas A. Powell (tpowell@pint.com) is the founder and CEO of PINT, Inc., a nationally known Web development and consulting firm. He is also the founder of a number of long-running software firms, including ZingChart (zingchart.com), a JavaScript charting and visualization library vendor; and Port80 Software (port80software.com), a maker of Web server security and performance software. He has written numerous books, including HTML & CSS: The Complete Reference, Ajax: The Complete Reference, Web Design: The Complete Reference, Web Site Engineering, and numerous others. Mr. Powell also teaches Web development classes for the University of California, San Diego Computer Science and Engineering Department, as well as for the Information Technologies program at UCSD Extension. He holds a B.S. from UCLA and an M.S. in Computer Science from UCSD.
Fritz Schneider is a Staff Software Engineer at Google where he leads web serving and UI infrastructure projects. His past work includes a social web startup acquired by Google, contributions to anonymizing web proxies, and a prior stint at Google where he improved browser security by founding the Safe Browsing project. He holds a B.S. in Computer Engineering from Columbia and an M.S. in Computer Science from UCSD.
About the Technical Editor
Christie Sorenson is a senior software engineer at ZingChart. She has worked on JavaScript-based systems in analytics, content management, and business applications since 1997 and has been fascinated with the evolution of the language and its users. She has collaborated with Thomas on numerous other projects, including Ajax: The Complete Reference and HTML & CSS: The Complete Reference . She has a B.S. in Computer Science from UC San Diego and now lives in San Francisco with her husband Luke and daughters, Ali and Keira. As a lifelong fan of the San Francisco Giants, any references in this book to the team are solely due to her influence.
Contents at a Glance
Acknowledgments
Much has changed in the decade between this and the last edition of this book, but one thing has stayed the same: getting a book this size out the door takes a whole lot of help and patience from a large number of people. Ill thank a few of them here and hope that the rest understand that I am grateful for all of the help and latitude they have given me over the course of this long project.
First off, my wonderful wife, Sylvia, and my children, Graham, Olivia, and Desmond, always gave me reasons why I should leave the world of JavaScript and take a break. My long-time collaborator, Christie Sorenson, helped in too many ways to enumerate here, so much so that she was even pulled in to do the technical edit of the book. Rob McFarlane helped by creating line art manuscript again and will sadly cringe seeing new clip art thrown over his work by the production department. Sorry, Robthey have their rules! I wont name all of the people at my company and beyond with whom I interacted and who influenced me or helped me shape the JavaScript content in the book, but a few warrant a shout-out, including Mike silkjs Schwartz, Tom the Man Maneri, D. Sargent, Joe Lima, Adrian Zaharia, and Allan Pister. Kyle Simpson also should be mentioned for his helpful and diligent assistance in some of the chapter materials on object and performance.
I should give special thanks to the folks at McGraw-Hill for helping this book make its long, slow journey to paper. Megg Morin, in particular, whom I have worked with for approaching a decade now, probably wanted to quote the actor Danny Glovers most famous line on a daily basis while dealing with this book. I believe, in fact, that in the distant future, Having the patience of Megg may become a common phrase. I also must not forget LeeAnn Pickrell, Stephanie Evans, Janet Walden, Joya Anthony, and, I am sure, many others who kept this process going.
Next page