Team LiB
Previous Section Next Section

JavaScript 2.0—The Complete Reference, Second Edition

Second Edition

Thomas Powell
Fritz Schneider


New York Chicago San Francisco
Lisbon London Madrid Mexico City
Milan New Delhi San Juan
Seoul Singapore Sydney Toronto

2100 Powell Street, 10th Floor
Emeryville, California 94608

To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please contact McGraw-Hill/Osborne at the above address. For information on translations or book distributors outside the U.S.A., please see the International Contact Information page immediately following the index of this book.

JavaScript: The Complete Reference, Second Edition

Copyright 2004 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 the 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.

1234567890 CUS CUS 01987654
ISBN 0-07-225357-6

Publisher: Brandon A. Nordin

Vice President & Associate Publisher: Scott Rogers

Acquisitions Editor: Lisa McClain

Project Editor: Kenyon Brown

Acquisitions Coordinator: Athena Honore

Copy Editor: Claire Splan

Proofreader: Linda Medoff

Indexer: Jack Lewis

Computer Designers: Jim Kussow, Dick Schwartz

Illustrators: Kathleen Edwards, Melinda Lytle

Series Design: Peter F. Hancik, Lyssa Wald

This book was composed with Corel VENTURA Publisher.

Information has been obtained by McGraw-Hill/Osborne from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill/Osborne, or others, McGraw-Hill/Osborne 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 use of such information.

About the Authors

Thomas Powell ( has been involved in the Internet community for well over ten years. In the early 1990s he worked for the first Internet service provider in Southern California, CERFnet. In 1994 he founded PINT, Inc. (, a Web development and consulting firm with headquarters in San Diego, which services numerous corporate clients around the country.

Powell is also the author of numerous other Web development books including the bestsellers, HTML & XHTML: The Complete Reference, Web Design: The Complete Reference, and Web Site Engineering. He also writes frequently about Web technologies for Network World magazine.

Mr. Powell teaches Web design and development classes for the University of California, San Diego Computer Science and Engineering Department, as well as the Information Technologies program at the UCSD Extension. He holds a B.S. from UCLA and a M.S. in Computer Science from UCSD.

Fritz Schneider received a B.S. in Computer Engineering from Columbia University and an M.S. in Computer Science from UC San Diego. He works as a Software Engineer at Google, and his prior work experience includes time spent in Web development, privacy, and security. Among other things, he spends his time lobbying Google’s management on the obvious need for an engineering office in Fiji. Until the lobby succeeds, he’s content to live in San Francisco and dream of a world without war, and a city without parking enforcement.


When you take the time out of your life to write a doorstop-sized book like this one, you tend to rely on a lot of people’s assistance. I’ll mention only a few of them here to avoid adding too many more pages to this already massive tome.

First off, as expected, the folks at Osborne were a pleasure to work with. The cast of characters changes from book to book but always are a pleasure to work with: Athena Honore, Lisa McClain, Nancy Maragioglio, Kenyon Brown, Claire Splan, Linda Medoff, and Jack Lewis. Our technical editor Michael Linde did his best to keep us accurate. Megg Morin wasn’t involved in this particular project, but given my long history with Osborne, she deserves mention for guiding me through everything to this point.

Special mention to my outside editorial strike force of one should go to Daisy Bhonsle, who provided excellent assistance far beyond my expectations. Her eagle eye for details is rare in this world.

The employees at PINT provide dozens of right hands for me and deserve special mentions. First, Mine Okano has helped run another book project and has done an excellent job at it. Mine also deserves special thanks for juggling this book project while preparing for her wedding. Fritz and I wish her and Marc much happiness in their life together.

Other PINTsters always lend a hand when I need it. In particular, Jeremy Weir provided great assistance preparing advanced demos in later chapters. Cory Ducker and Marcus Richard also helped out with little code projects as they arose. Dave Andrews, as always, could be counted on for related network and server issues. Other PINT employees including Dan Whitworth, Catrin Walsh, Jimmy Tam, Rob McFarlane, James Brock, Vergil Pascual, Eric Raether, Cathleen Ryan, Meredith Hodge, Scott Hedstrom, Ryan Herndon, David Sanchez, Melinda Serrato, Darlene Hernandez, Michele Bedard, Candice Fong, Heather Jurek, Kun Puparussanon, Kevin Griffith, Nick Carter, and numerous others helped out by just keeping the projects rolling while I was busy. Joe Lima, Allan Pister, Christie Sorenson, Chris Neppes, Andy Lohr, Tad Fleshman, and Jared Ashlock deserve some praise for getting some of my outside software project duties taken care of as well.

Students in undergraduate and extension classes always make good points and many of their ideas are incorporated into this edition.

Somehow I find time outside of the Web for friends, family, and home. My wife Sylvia in particular made sure I didn’t work all day every weekend. Tucker and Angus, who make their print debut in Chapter 16, always forced that issue.

Last, the most thanks go to the thousands of readers around the world who have purchased my various Web technology and design books. It is really a great pleasure to get such positive feedback and see folks putting this information to good use.

Thomas A. Powell
June 2004

I’d like to acknowledge the patience and hard work of my co-author, Thomas, and the time he’s spent talking to me about various topics, both technical and otherwise. Also Mine Okano for her continual assistance with this project, not to mention her sense of humor. Deserved of thanks is my manager at Google, Bill Coughran, for his confidence and support.

And since this book is nearly a thousand pages long and Thomas did a great job of thanking those who helped us, I’ll do you the reader a favor and leave it at that :)

Fritz Schneider
June 2004

Team LiB
Previous Section Next Section