You are previewing Dynamic HTML: The Definitive Reference, 3rd Edition.
O'Reilly logo
Dynamic HTML: The Definitive Reference, 3rd Edition

Book Description

Packed with information on the latest web specifications and browser features, this new edition is your ultimate one-stop resource for HTML, XHTML, CSS, Document Object Model (DOM), and JavaScript development. Here is the comprehensive reference for designers of Rich Internet Applications who need to operate in all modern browsers, including Internet Explorer 7, Firefox 2, Safari, and Opera.

With this book, you can instantly see browser support for the latest standards-based technologies, including CSS Level 3, DOM Level 3, Web Forms 2.0, XMLHttpRequest for AJAX applications, JavaScript 1.7, and many more. This new edition:

  • Provides at-a-glance references for the tags, attributes, objects, properties, methods, and events of HTML, XHTML, CSS, DOM, and core JavaScript. You can quickly look up a particular feature or language term to see if it is available in desired browser brands and versions.

  • Includes handy cross referencing that lets you look up an attribute (or object property, method, or event type) to find all the items that recognize it, including interrelated HTML tags, style properties, and document object model methods, properties, and events.

  • Offers appendices where you can quickly locate values useful in HTML authoring and scripting. You'll find coverage of commands used across three browsers for user-editable content.

  • Includes a glossary that gives you quick explanations of some of the new and potentially confusing terminology of DHTML.

Dynamic HTML: The Definitive Reference speeds the way to adding sophisticated features to your web pages. Indispensable, complete, and succinct, this bestselling guide is the must-have compendium for all web developers involved in creating dynamic web content.

Table of Contents

  1. Preface
    1. What You Should Already Know
    2. Contents of This Book
    3. Conventions Used in This Book
    4. Additional Online Content
    5. Using Code Examples
      1. Safari® Enabled
    6. How to Contact Us
    7. Acknowledgments
  2. I. Dynamic HTML Reference
    1. 1. HTML and XHTML Reference
      1. 1.1. Attribute Value Types
        1. 1.1.1. Length
        2. 1.1.2. Identifier
        3. 1.1.3. URI and URL
        4. 1.1.4. Language Code
        5. 1.1.5. Alignment Constants
          1. 1.1.5.1. Alignment outside the box
          2. 1.1.5.2. Text alignment inside the containing box
          3. 1.1.5.3. Horizontal alignment of a block element
          4. 1.1.5.4. Horizontal text alignment in a table cell
          5. 1.1.5.5. Vertical text alignment inside an element
        6. 1.1.6. Colors
      2. 1.2. Shared HTML Element Attributes
        1. 1.2.1. Attributes
      3. 1.3. Shared Event Handler Attributes
      4. 1.4. Alphabetical Tag Reference
    2. 2. Document Object Model Reference
      1. 2.1. Property Value Types
        1. 2.1.1. Length
        2. 2.1.2. Identifier
        3. 2.1.3. URI and URL
        4. 2.1.4. Language Code
        5. 2.1.5. Colors
      2. 2.2. About client- and offset- Properties
      3. 2.3. Default Property Values
      4. 2.4. Events
      5. 2.5. Static W3C HTML DOM Objects
      6. 2.6. Shared Object Properties, Methods, and Events
        1. 2.6.1. Shared Element Object Properties
        2. 2.6.2. Shared Element Object Methods
        3. 2.6.3. Shared Element Object Events
      7. 2.7. Alphabetical Object Reference
    3. 3. Event Reference
      1. 3.1. Alphabetical Event Reference
    4. 4. Style Sheet Property Reference
      1. 4.1. Property Value Types
        1. 4.1.1. Length
        2. 4.1.2. URI and URL (and IRI)
        3. 4.1.3. Colors
      2. 4.2. Selectors
      3. 4.3. Pseudo-Element and Pseudo-Class Selectors
        1. 4.3.1. Pseudo-Elements
        2. 4.3.2. Pseudo-Classes
      4. 4.4. At-Rules
      5. 4.5. Conventions
      6. 4.6. Alphabetical Property Reference
    5. 5. JavaScript Core Language Reference
      1. 5.1. About Static Objects
      2. 5.2. Mozilla Get and Set Methods
      3. 5.3. ECMAScript for XML (E4X)
      4. 5.4. ECMAScript Reserved Keywords
      5. 5.5. Core Objects
      6. 5.6. Operators
      7. 5.7. Control Statements
      8. 5.8. Miscellaneous Statements
      9. 5.9. Special (Escaped) String Characters
  3. II. Cross References
    1. 6. HTML/XHTML Attribute Index
    2. 7. DOM Property Index
    3. 8. DOM Method Index
    4. 9. DOM Events Index
  4. III. Appendixes
    1. A. Color Names and RGB Values
    2. B. HTML Character Entities
    3. C. Keyboard Event Character Values
    4. D. Editable Content Commands
      1. D.1. The Command System
      2. D.2. Commanding an Editable Document
      3. D.3. TextRange Features
    5. E. HTML/XHTML DTD Support
    6. F. The Mozilla Browser Version Trail
    7. Glossary
  5. IV. Applying Dynamic HTML
    1. ONLINE SECTION I. The State of the Art: Standards
      1. I.1. The Standards Alphabet Soup
      2. I.2. Version Headaches
      3. I.3. HTML
      4. I.4. XHTML
        1. I.4.1. XHTML 1.0/1.1
        2. I.4.2. XHTML 2.0
        3. I.4.3. HTML or XHTML?
      5. I.5. Cascading Style Sheets
        1. I.5.1. CSS Rationale
        2. I.5.2. Element Positioning and Layering
      6. I.6. Document Object Model
        1. I.6.1. DOM Level 0
        2. I.6.2. Microsoft IE 4 DOM
        3. I.6.3. W3C DOM Architecture
      7. I.7. Web API
      8. I.8. Web Accessibility Initiative (WAI)
      9. I.9. Web Hypertext Application Technology Working Group (WHATWG)
      10. I.10. ECMAScript
      11. I.11. De Facto Standards
      12. I.12. A Fragmenting World
    2. ONLINE SECTION II. Cross-Platform Compromises
      1. II.1. What Is a Platform?
      2. II.2. Standards-Compatible DHTML
        1. II.2.1. Simple Element Object References
        2. II.2.2. Cascading Style Sheets
        3. II.2.3. Positioning and Layering
        4. II.2.4. Dynamic Content
        5. II.2.5. The XMLHttpRequest Object
        6. II.2.6. The Event Model
        7. II.2.7. Operating System Support
      3. II.3. Internet Explorer DHTML
        1. II.3.1. Element Object References
        2. II.3.2. Cascading Style Sheets
        3. II.3.3. Dynamic Content
        4. II.3.4. The XMLHttpRequest Object
        5. II.3.5. The Event Model
        6. II.3.6. Transitions and Filters
        7. II.3.7. Downloadable Fonts
        8. II.3.8. Data Binding
        9. II.3.9. Additional Windows-Only Features
        10. II.3.10. Macintosh Versions
      4. II.4. Cross-Platform Strategies
        1. II.4.1. Adding Value with DHTML
        2. II.4.2. Serving Pages by Browser Type
        3. II.4.3. Object Detection over Browser Sniffing
        4. II.4.4. Designing for the Common Denominator
        5. II.4.5. Custom APIs
      5. II.5. Using Third-Party APIs and Frameworks
    3. ONLINE SECTION III. Adding Cascading Style Sheets to Documents
      1. III.1. Observing HTML Structures
      2. III.2. Understanding the Box Model
        1. III.2.1. Box Pieces
        2. III.2.2. Box Positioning
      3. III.3. Two Types of Containment
        1. III.3.1. Inheritance
        2. III.3.2. The Cascade
      4. III.4. Of Style Sheets, Elements, Properties, and Values
        1. III.4.1. Style Properties—An Overview
        2. III.4.2. CSS Property Assignment Syntax
        3. III.4.3. Binding CSS Declarations to Elements
      5. III.5. Embedding Style Sheets
        1. III.5.1. In-Document Styles
          1. III.5.1.1. The <style> tag
          2. III.5.1.2. The style attribute in element tags
        2. III.5.2. Importing External Style Sheets
          1. III.5.2.1. External style sheet files
          2. III.5.2.2. The link element
          3. III.5.2.3. The @import rule
        3. III.5.3. Loading Browser-Specific Style Sheets
        4. III.5.4. Selecting a Style Sheet Style
      6. III.6. Common Subgroup Selectors
        1. III.6.1. Class Selectors
          1. III.6.1.1. Binding a class identifier to an element type
          2. III.6.1.2. Defining a free-range class rule
        2. III.6.2. ID Selectors
        3. III.6.3. Descendant Selectors
      7. III.7. Advanced Subgroup Selectors
        1. III.7.1. Pseudo-Element and Pseudo-Class Selectors
          1. III.7.1.1. Using pseudo-elements
          2. III.7.1.2. Using pseudo-classes
          3. III.7.1.3. CSS3 pseudo-classes
        2. III.7.2. Attribute Selectors
        3. III.7.3. Universal Selectors
        4. III.7.4. Child Selectors
        5. III.7.5. Adjacent Sibling Selectors
      8. III.8. Cascade Precedence Rules
        1. III.8.1. Making a Declaration Important
        2. III.8.2. Determining a Selector’s Specificity
      9. III.9. Cross-Platform Style Differences
    4. ONLINE SECTION IV. Changing Page Content and Styles
      1. IV.1. Writing Variable Content
      2. IV.2. Writing to Other Frames and Windows
        1. IV.2.1. Framesets and Frames
        2. IV.2.2. Secondary Windows
      3. IV.3. Image Swapping
        1. IV.3.1. Preparing for the Initialization
        2. IV.3.2. Defining a “Rollover” Object
        3. IV.3.3. Rollovers and the Status Bar
        4. IV.3.4. Internet Explorer Caching Issues
      4. IV.4. CSS-Only Image Swaps
      5. IV.5. Changing Tag Attribute Values
      6. IV.6. Changing Applied Style Values
        1. IV.6.1. The style Property
        2. IV.6.2. The className Property
        3. IV.6.3. Other Techniques
      7. IV.7. Changing Content
        1. IV.7.1. Changing Element Text
          1. IV.7.1.1. IE text
          2. IV.7.1.2. W3C DOM text
        2. IV.7.2. Changing Elements and Document Structure
          1. IV.7.2.1. IE HTML and elements
          2. IV.7.2.2. W3C DOM document tree
      8. IV.8. Dynamic Tables
      9. IV.9. Blending XML Data into HTML Pages
        1. IV.9.1. Embedding XML Data
        2. IV.9.2. Retrieving the XML
        3. IV.9.3. Parsing the XML Document
        4. IV.9.4. Converting XML to JavaScript Objects
      10. IV.10. Working with Text Ranges
        1. IV.10.1. Browser Support
        2. IV.10.2. Typical Text Range Operations
      11. IV.11. Combining Forces: A Custom Newsletter
    5. ONLINE SECTION V. Adding Dynamic Positioning to Documents
      1. V.1. Creating Positionable Elements
        1. V.1.1. Setting an Element’s position Property
        2. V.1.2. Absolute Versus Relative Positioning
        3. V.1.3. Overlapping Versus Wrapping Elements
      2. V.2. Positioning Properties
        1. V.2.1. The position Property
        2. V.2.2. top, right, bottom, and left Properties
        3. V.2.3. The clip Property
        4. V.2.4. The overflow Property
        5. V.2.5. The visibility Property
        6. V.2.6. The z-index Property
      3. V.3. Changing Positioning Values via Scripting
        1. V.3.1. Referencing Position Styles
        2. V.3.2. Positionable Element Properties
        3. V.3.3. Reading Effective Style Properties
          1. V.3.3.1. IE currentStyle property
          2. V.3.3.2. W3C getComputedStyle( ) method
      4. V.4. Cross-Platform Position Scripting
        1. V.4.1. Using a Custom Positioning API
        2. V.4.2. A Sample Positioning API
      5. V.5. Common Positioning Tasks
        1. V.5.1. Centering an Object
        2. V.5.2. Flying Objects
    6. ONLINE SECTION VI. Scripting Events
      1. VI.1. Event Types
      2. VI.2. Event Objects
        1. VI.2.1. Event Objects and Event Models
        2. VI.2.2. Event Object Properties
      3. VI.3. Binding Events to Elements
        1. VI.3.1. Events as Tag Attributes
        2. VI.3.2. Events as Object Properties
        3. VI.3.3. Attaching Events (IE 5 and Later for Windows)
        4. VI.3.4. W3C Event Listeners (Mozilla, Safari, Opera)
        5. VI.3.5. Binding Multiple Events
      4. VI.4. Preventing Default Event Actions
        1. VI.4.1. Setting the return Value
        2. VI.4.2. The event.returnValue Property (IE 5 and Later)
        3. VI.4.3. W3C preventDefault( ) Method
        4. VI.4.4. Cross-Browser Techniques
      5. VI.5. Event Propagation
        1. VI.5.1. Event Bubbling
        2. VI.5.2. W3C Event Capture
        3. VI.5.3. IE/Windows Event Capture
      6. VI.6. Understanding Keyboard Event Data
      7. VI.7. Dragging Elements
      8. VI.8. Event Futures
    7. ONLINE SECTION VII. XMLHttpRequest and Ajax
      1. VII.1. A Brief History Lesson
      2. VII.2. Application Design Considerations
        1. VII.2.1. Ajax and the Server
        2. VII.2.2. Browser History and the Back Button
        3. VII.2.3. URLs and Bookmarks
      3. VII.3. Using XMLHttpRequest
        1. VII.3.1. Overview
        2. VII.3.2. Creating a Request Object
        3. VII.3.3. Request Object Methods
        4. VII.3.4. Request Object Properties
        5. VII.3.5. Handling the Request Response
      4. VII.4. Debugging XMLHttpRequest Code
        1. VII.4.1. Inspect the readyState Property After a Request
        2. VII.4.2. Inspect the nodeType and childNodes of the responseXML Property
        3. VII.4.3. Make Sure Your XML is Well-Formed
      5. VII.5. REST Versus SOAP
      6. VII.6. Using XMLHttpRequest for Other Data Types
  6. Index
  7. About the Author
  8. Colophon
  9. Copyright