Preface

I am going to admit a selfish motive for writing this book and, more recently, updating it to the third edition: I needed the finished product for my own consulting and development work. After struggling in the early Version 4 browser days with tangled online references and monstrous printed versions of Netscape, Microsoft, and World Wide Web Consortium (W3C) documentation for Dynamic HTML (DHTML) features, I had had enough. My human brain could no longer store the parallels and discrepancies of the hundreds of terms for HTML attributes, style sheets, and scriptable object models. And no browser maker was about to tell me how compatible a particular feature might be in another browser. It was clearly time to roll my own reference.

At first, I thought the project would be a relatively straightforward blending of content from available sources, with a pinch of my development experience thrown in for flavoring. But the more I examined the existing documents, the worse the situation became. Developer documentation from the browser makers, and even the W3C, contained inconsistencies and incomplete (if at times erroneous) information. From the very beginning, it was clear that I could not trust everything I read, but instead had to try as much as I could on as many browsers and browser versions as I could. Multiply all that code testing by the hundreds of HTML attributes, CSS properties, object properties, object methods, and events for the first edition . . . before I knew it, many extra months of day-and-night coding and writing were history.

Creating the second edition was no less harrowing. The W3C DOM had come on the scene, bringing entirely new concepts about object models. Reconciling the ideals of the W3C specifications against the development work on the Mozilla browser meant many hours combing through the browser’s source code and bug reports for clues about what was broken, about-to-be-fixed, or put on hold for the future. Combining those developments with an ever-growing vocabulary in the proprietary Internet Explorer world, the amount of information had grown to unimaginable proportions: more than 15,000 unique instances of properties, methods, and event handlers supported by numerous document objects.

The need for this third edition grew from several stimuli. Although the Internet Explorer browser had been static for a number of years, the browser world was not standing still. Mozilla blossomed as an attractive alternative for many everyday users. On the Macintosh side of the aisle, the bundled Safari browser had established itself as the primary web access tool for a growing cadre of Mac OS X users. Undaunted by such competition, the Opera folks also kept up the development pace, adding in Opera 9 many bleeding-edge features, such as Web Forms 2.0. In the meantime, several W3C working groups finalized (or neared completion of) key Level 3 DOM and CSS modules, some of whose features were finding their way into non-IE browsers. Keeping track of which browser does what is no less difficult today than it has ever been.

That’s all the more reason that I’m thrilled to produce this third edition, so that I have a DHTML reference that is always within arm’s reach at my workstation. I even have the duct tape ready for the day when the cover surrenders to too many twists and turns.

I would be the last person on the planet to promise that this book is perfect in every way. While the predictability and reliability of DHTML scripting have increased significantly since the days of the first edition, I still find discrepancies between vendor or standards documentation and observable reality in mainstream browsers. In such cases, I document the reality. In doing so, I recall my high school physics teacher who would shout to the class, “Seeing is believing!” and then promptly demonstrate an optical illusion. I hope that my long experience in this field has helped me see through the illusions, so that I may relate the true reality.

What You Should Already Know

Because this is a reference book, it has been written with the assumption that you have at least dabbled in Dynamic HTML. You should already be HTML-literate and know the basics of client-side scripting in JavaScript. You need not be a DHTML expert, but even the supplementary online instructional sections are very much crash courses, intended for readers who are already comfortable with hand-coding web pages (or at least modifying the HTML generated by WYSIWYG authoring tools).

Contents of This Book

This book is divided into three parts:

Part I, Dynamic HTML Reference

The chapters of Part I provide at-a-glance references for the tags, attributes, objects, properties, methods, and events of HTML, XHTML, CSS, DOM, and core JavaScript. These are the chapters I use all the time to look up the attributes of an HTML element or to see whether a particular object property is available in the desired browser brands and versions. Every effort has been expended to present this information in a condensed yet meaningful format. At the same time, I have expanded compatibility coverage to include Safari and Opera browsers.

Part II, Cross References

The chapters in Part II slice through the information of Part I along different angles. Perhaps you recall the name of an attribute you found useful some time ago, but don’t recall which elements provide that attribute. Here you can look up that attribute (or object property, method, or event type) to find all the items that recognize it.

Part III, Appendixes

Several appendixes provide quick lookup for a variety of values useful in HTML authoring and scripting. Appendix D has been expanded to include coverage of commands used across three browsers for user-editable content. A glossary also gives you quick explanations of some of the new and potentially confusing terminology of DHTML.

Conventions Used in This Book

Italic is used for:

  • Pathnames, filenames, program names, email addresses, and web sites

  • New terms where they are defined

Bold is used for:

  • Keys

  • GUI menu items and buttons

Constant Width is used for:

  • Any HTML, CSS, or scripting term, including HTML tags, attribute names, object names, properties, methods, and event handlers

  • All HTML and script code listings

Constant Width Italic is used for:

  • Method and function parameters or assigned value placeholders that indicate an item is to be replaced by a real value in actual use

Additional Online Content

Readers of earlier editions will notice in this edition the absence of the chapters that expound on DHTML standards and application issues. Fear not! To make room for ever-expanding reference material in this third edition, I have updated those chapters (substantially in many cases) and made them available for immediate download at http://www.oreilly.com/catalog/dhtmlref3. The seven online sections are as follows:

Online Section I, The State of the Art: Standards
Online Section II, Cross-Platform Compromises
Online Section III, Adding Cascading Style Sheets to Documents
Online Section IV, Changing Page Content and Styles
Online Section V, Adding Dynamic Positioning to Documents
Online Section VI, Scripting Events
Online Section VII, XMLHttpRequest and Ajax

Using Code Examples

This book is here to help you get your job done. In general, you may use the shell scripts in this book in your own scripts and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of a script. For example, selling or distributing a CD-ROM of examples from O’Reilly books requires permission. Answering a question by citing this book and quoting a script does not require permission. Incorporating a significant amount of a script from this book into your product’s code or documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Dynamic HTML: The Definitive Reference, Third Edition, by Danny Goodman. Copyright 2007 O’Reilly Media, Inc., 978-0-596-52740-2.”

If you feel your use of code examples falls outside fair use or them permission given above, feel free to contact us at .

Safari® Enabled

When you see a Safari® enabled icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it free at http://safari.oreilly.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)

Your feedback on the quality of this book is important to us. If you discover any errors, bugs, typos, explanations that you cannot grok, or platform-specific issues not covered here, please let us know. You can email your bug reports and comments to us at:

Also be sure to check the web page for this book, which lists errata, examples, or any additional information. You can access this page at:

http://www.oreilly.com/catalog/9780596527402

Previously reported errors and corrections are available for public view and further comment.

For more information about books, conferences, Resource Centers, and the O’Reilly Network, see the O’Reilly web site at:

http://www.oreilly.com

Acknowledgments

Despite the ever-increasing heft of the books I have written in the past several years, you’ll have to take my word for it: I do not delight in making forests tremble with each added word. It’s just that the subject matter has grown to outsized proportions. No matter how succinct one tries to be, the pages add up quickly.

A book of this scale and design complexity places enormous burdens on a great many people who turn my mere bytes into gorgeous pages and chapters. Thanks to Tim O’Reilly for continuing to be true to his author-friendly roots, while building a technology powerhouse whose reputation for quality is awe-inspiring. His editorial and production staffs consistently work miracles under extreme deadline pressures.

My true reward comes from having helped you unlock your own talent to create great solutions. Your encouragement has inspired me to do what I hope is an even better job this third time around to guide you through the newest advances in client-side scripting and web development. To new readers, I bid you welcome. Let’s all have some fun exploring the power and promise of Dynamic HTML.

Get Dynamic HTML: The Definitive Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.