You are previewing JavaScript® Bible, Seventh Edition.
O'Reilly logo
JavaScript® Bible, Seventh Edition

Book Description

The bestselling JavaScript reference, now updated to reflect changes in technology and best practices

As the most comprehensive book on the market, the JavaScript Bible is a classic bestseller that keeps you up to date on the latest changes in JavaScript, the leading technology for incorporating interactivity into Web pages. Part tutorial, part reference, this book serves as both a learning tool for building new JavaScript skills as well as a detailed reference for the more experienced JavaScript user.

You'll get up-to-date coverage on the latest JavaScript practices that have been implemented since the previous edition, as well as the most updated code listings that reflect new concepts. Plus, you'll learn how to apply the latest JavaScript exception handling and custom object techniques.

  • Follows in the tradition of previous edition bestsellers, providing a thorough reference on JavaScript, the leading technology for making Web pages interactive

  • Serves as a reference and tutorial and is packed with numerous working code examples

  • Includes new developments in the ECMAScript 5th Edition standard on which JavaScript is based.

  • Promotes state-of-the-art industry best practices including progressive enhancement, unobtrusive JavaScript, and separation of development layers

  • Shows how to write scripts for mouse rollover effects, drag-and-drop, and interaction with stylesheets

  • Reviews deployment strategies that best suit your content goals and target audience

Practical examples of working code round out this new edition and contribute to helping you learn JavaScript quickly yet thoroughly.

Table of Contents

  1. Copyright
  2. About the Authors
  3. About the Technical Editor
  4. Credits
  5. Acknowledgments
  6. Introduction
    1. Organization and Features of This Edition
      1. Part I: Getting Started with JavaScript
      2. Part II: JavaScript Tutorial
      3. Part III: JavaScript Core Language Reference
      4. Part IV: Document Objects Reference
      5. Part V: Appendixes
      6. Part VI: Document Objects Reference (continued)
      7. Part VII: More JavaScript Programming
      8. Part VIII: Applications
      9. Part IX: Appendixes (continued)
      10. CD-ROM
    2. Prerequisites to Learning JavaScript
      1. If you've never programmed before
      2. If you've done a little programming before
      3. If you've programmed in C before
      4. If you've programmed in Java before
      5. If you've written scripts (or macros) before
    3. Formatting and Naming Conventions
  7. I. Getting Started with JavaScript
    1. 1. JavaScript's Role in the World Wide Web and Beyond
      1. 1.1. Competing for Web Traffic
      2. 1.2. Other Web Technologies
        1. 1.2.1. Hypertext Markup Language (HTML and XHTML)
        2. 1.2.2. Cascading Style Sheets (CSS)
        3. 1.2.3. Server-side programming
        4. 1.2.4. Of helpers and plug-ins
      3. 1.3. JavaScript: A Language for All
        1. 1.3.1. LiveScript becomes JavaScript
        2. 1.3.2. Enter Microsoft and others
        3. 1.3.3. JavaScript versions
        4. 1.3.4. Core language standard: ECMAScript
      4. 1.4. JavaScript: The Right Tool for the Right Job
    2. 2. Developing a Scripting Strategy
      1. 2.1. Browser Leapfrog
      2. 2.2. Duck and Cover
      3. 2.3. Compatibility Issues Today
        1. 2.3.1. Separating the core JavaScript language from document objects
        2. 2.3.2. Core language standard
        3. 2.3.3. Document object model
        4. 2.3.4. Laying a good foundation with markup
        5. 2.3.5. Cascading Style Sheets
        6. 2.3.6. Standards compatibility modes (DOCTYPE switching)
        7. 2.3.7. Dynamic HTML and positioning
      4. 2.4. Developing a Scripting Strategy
        1. 2.4.1. Graceful degradation and progressive enhancement
        2. 2.4.2. Separation of development layers
        3. 2.4.3. Further reading
    3. 3. Selecting and Using Your Tools
      1. 3.1. The Software Tools
        1. 3.1.1. Choosing a text editor
        2. 3.1.2. Choosing a browser
      2. 3.2. Setting Up Your Authoring Environment
        1. 3.2.1. Windows
        2. 3.2.2. Mac OS X
        3. 3.2.3. Reloading issues
      3. 3.3. Validate, Validate, Validate
      4. 3.4. Creating Your First Script
        1. 3.4.1. Stage 1: static HTML
        2. 3.4.2. Stage 2: connecting with JavaScript
        3. 3.4.3. Stage 3: styling with CSS
    4. 4. JavaScript Essentials
      1. 4.1. Combining JavaScript with HTML
        1. 4.1.1. <script> tags
          1. 4.1.1.1. Linking to script libraries (.js files)
          2. 4.1.1.2. Specifying the MIME type & language
          3. 4.1.1.3. Specifying the language version
          4. 4.1.1.4. The deprecated language attribute
          5. 4.1.1.5. The proprietary for and event attributes
        2. 4.1.2. Old-school inline JavaScript
        3. 4.1.3. Accommodating the JavaScript-incapable user agent
          1. 4.1.3.1. Commenting out script in HTML
          2. 4.1.3.2. Commenting out script in XHTML as character data
          3. 4.1.3.3. The noscript tag
        4. 4.1.4. Hiding scripts (not!)
        5. 4.1.5. Scripting for different browsers
          1. 4.1.5.1. Building the foundation beneath the towers
          2. 4.1.5.2. Choosing your battles
          3. 4.1.5.3. Object detection
          4. 4.1.5.4. Browser version detection
      2. 4.2. Designing for Compatibility
        1. 4.2.1. Dealing with beta browsers
        2. 4.2.2. Compatibility ratings in reference chapters
      3. 4.3. Language Essentials for Experienced Programmers
        1. 4.3.1. The Evaluator Sr.
  8. II. JavaScript Tutorial
    1. 5. Your First JavaScript Script
      1. 5.1. What Your First Script Will Do
      2. 5.2. Entering Your First Script
        1. 5.2.1. Step 1: The HTML document
          1. 5.2.1.1. DOCTYPE
          2. 5.2.1.2. html
          3. 5.2.1.3. head
          4. 5.2.1.4. body
          5. 5.2.1.5. headline
          6. 5.2.1.6. paragraph
        2. 5.2.2. Step 2: Adding JavaScript
          1. 5.2.2.1. Triggering the event
          2. 5.2.2.2. Ensuring a safe environment
          3. 5.2.2.3. Generating the date and time
          4. 5.2.2.4. Finding the target
          5. 5.2.2.5. Deleting what's there
          6. 5.2.2.6. Inserting the date and time
          7. 5.2.2.7. Debugging
        3. 5.2.3. Step 3: Adding style
      3. 5.3. Have Some Fun
      4. 5.4. Exercises
    2. 6. Browser and Document Objects
      1. 6.1. Scripts Run the Show
      2. 6.2. When to Use JavaScript
      3. 6.3. The Document Object Model
        1. 6.3.1. HTML structure and the DOM
        2. 6.3.2. The DOM in a browser window
      4. 6.4. When a Document Loads
        1. 6.4.1. A simple document
        2. 6.4.2. Add a paragraph element
        3. 6.4.3. Add paragraph text
        4. 6.4.4. Make a new element
      5. 6.5. Object References
        1. 6.5.1. Object naming
        2. 6.5.2. Referencing a particular object
      6. 6.6. Node Terminology
        1. 6.6.1. About nodes
        2. 6.6.2. Parents and children
      7. 6.7. What Defines an Object?
        1. 6.7.1. Properties
        2. 6.7.2. Methods
        3. 6.7.3. Events
      8. 6.8. Exercises
    3. 7. Scripts and HTML Documents
      1. 7.1. Connecting Scripts to Documents
        1. 7.1.1. Tag positions
        2. 7.1.2. Handling non-JavaScript browsers and XHTML
      2. 7.2. JavaScript Statements
      3. 7.3. When Script Statements Execute
        1. 7.3.1. While a document loads: immediate execution
        2. 7.3.2. Deferred scripts
          1. 7.3.2.1. Run after loading
          2. 7.3.2.2. Run by user
          3. 7.3.2.3. Called by another function
      4. 7.4. Viewing Script Errors
      5. 7.5. Scripting versus Programming
      6. 7.6. Exercises
    4. 8. Programming Fundamentals, Part I
      1. 8.1. What Language Is This?
      2. 8.2. Working with Information
      3. 8.3. Variables
        1. 8.3.1. Creating variables
        2. 8.3.2. Naming variables
      4. 8.4. Expressions and Evaluation
        1. 8.4.1. Expressions in scripts
        2. 8.4.2. Expressions and variables
      5. 8.5. Data Type Conversions
        1. 8.5.1. Converting strings to numbers
        2. 8.5.2. Converting numbers to strings
      6. 8.6. Operators
        1. 8.6.1. Arithmetic operators
        2. 8.6.2. Comparison operators
      7. 8.7. Exercises
    5. 9. Programming Fundamentals, Part II
      1. 9.1. Decisions and Loops
      2. 9.2. Control Structures
        1. 9.2.1. if constructions
        2. 9.2.2. if . . . else constructions
      3. 9.3. Repeat Loops
      4. 9.4. Functions
        1. 9.4.1. Function parameters
        2. 9.4.2. Variable scope
      5. 9.5. Curly Braces
      6. 9.6. Arrays
        1. 9.6.1. Creating an array
        2. 9.6.2. Accessing array data
        3. 9.6.3. Parallel arrays
        4. 9.6.4. Document objects in arrays
      7. 9.7. Exercises
    6. 10. Window and Document Objects
      1. 10.1. Top-Level Objects
      2. 10.2. The window Object
        1. 10.2.1. Accessing window properties and methods
        2. 10.2.2. Creating a window
      3. 10.3. window Properties and Methods
        1. 10.3.1. window.alert() method
        2. 10.3.2. window.confirm() method
        3. 10.3.3. window.prompt() method
        4. 10.3.4. load event
      4. 10.4. The location Object
      5. 10.5. The navigator Object
      6. 10.6. The document Object
        1. 10.6.1. document.getElementById() method
        2. 10.6.2. document.getElementsByTagName() method
        3. 10.6.3. document.forms[] property
        4. 10.6.4. document.images[] property
        5. 10.6.5. document.createElement() and document.createTextNode() methods
        6. 10.6.6. document.write() method
      7. 10.7. Exercises
    7. 11. Forms and Form Elements
      1. 11.1. The Form object
        1. 11.1.1. Form as object and container
        2. 11.1.2. Accessing form properties
        3. 11.1.3. form.elements[] property
      2. 11.2. Form Controls as Objects
        1. 11.2.1. Text-related input objects
        2. 11.2.2. The button input object
        3. 11.2.3. The checkbox input object
        4. 11.2.4. The radio input object
        5. 11.2.5. The select object
      3. 11.3. Passing Elements to Functions with this
      4. 11.4. Submitting and Prevalidating Forms
        1. 11.4.1. A word about submit()
      5. 11.5. Exercises
    8. 12. Strings, Math, and Dates
      1. 12.1. Core Language Objects
      2. 12.2. String Objects
        1. 12.2.1. Joining strings
        2. 12.2.2. String methods
          1. 12.2.2.1. Changing string case
          2. 12.2.2.2. String searches
          3. 12.2.2.3. Extracting copies of characters and substrings
      3. 12.3. The Math Object
      4. 12.4. The Date Object
      5. 12.5. Date Calculations
      6. 12.6. Exercises
    9. 13. Scripting Frames and Multiple Windows
      1. 13.1. Frames: Parents and Children
      2. 13.2. References Among Family Members
        1. 13.2.1. Parent-to-child references
        2. 13.2.2. Child-to-parent references
        3. 13.2.3. Child-to-child references
      3. 13.3. Frame-Scripting Tips
      4. 13.4. About iframe Elements
      5. 13.5. Highlighting Footnotes: A Frameset Scripting Example
      6. 13.6. References for Multiple Windows
      7. 13.7. Exercises
    10. 14. Images and Dynamic HTML
      1. 14.1. The Image Object
        1. 14.1.1. Interchangeable images
        2. 14.1.2. Pre-caching images
        3. 14.1.3. Creating image rollovers
      2. 14.2. Rollovers Without Scripts
      3. 14.3. The javascript: Pseudo-URL
      4. 14.4. Popular Dynamic HTML Techniques
        1. 14.4.1. Changing style sheet settings
        2. 14.4.2. Dynamic content via W3C DOM nodes
        3. 14.4.3. Dynamic content through the innerHTML property
      5. 14.5. Exercises
  9. III. JavaScript Core Language Reference
    1. 15. The String Object
      1. 15.1. String and Number Data Types
        1. 15.1.1. Simple strings
        2. 15.1.2. Building long string variables
        3. 15.1.3. Joining string literals and variables
        4. 15.1.4. Special inline characters
      2. 15.2. String Object
        1. 15.2.1. Syntax
        2. 15.2.2. About this object
        3. 15.2.3. Properties
          1. 15.2.3.1. Example
        4. 15.2.4. Parsing methods
          1. 15.2.4.1. Example
          2. 15.2.4.2. Example
          3. 15.2.4.3. Example
          4. 15.2.4.4. Example
          5. 15.2.4.5. Example
          6. 15.2.4.6. Example
          7. 15.2.4.7. Example
          8. 15.2.4.8. Example
          9. 15.2.4.9. Example
          10. 15.2.4.10. Example
          11. 15.2.4.11. Example
          12. 15.2.4.12. Example
          13. 15.2.4.13. Example
      3. 15.3. String Utility Functions
        1. 15.3.1. HTML markup methods
      4. 15.4. URL String Encoding and Decoding
    2. 16. The Math, Number, and Boolean Objects
      1. 16.1. Numbers in JavaScript
        1. 16.1.1. Integers and floating-point numbers
        2. 16.1.2. Hexadecimal and octal integers
        3. 16.1.3. Converting strings to numbers
        4. 16.1.4. Converting numbers to strings
        5. 16.1.5. When a number isn't a number
      2. 16.2. Math Object
        1. 16.2.1. Syntax
        2. 16.2.2. About this object
        3. 16.2.3. Properties
        4. 16.2.4. Methods
        5. 16.2.5. Creating random numbers
        6. 16.2.6. Math object shortcut
      3. 16.3. Number Object
        1. 16.3.1. Syntax
        2. 16.3.2. About this object
        3. 16.3.3. Properties
          1. 16.3.3.1. Example
          2. 16.3.3.2. Example
        4. 16.3.4. Methods
          1. 16.3.4.1. Example
          2. 16.3.4.2. Example
      4. 16.4. Boolean Object
        1. 16.4.1. Syntax
        2. 16.4.2. About this object
    3. 17. The Date Object
      1. 17.1. Time Zones and GMT
      2. 17.2. The Date Object
        1. 17.2.1. Creating a date object
        2. 17.2.2. Native object properties and methods
        3. 17.2.3. Date methods
        4. 17.2.4. Accommodating time zones
        5. 17.2.5. Dates as strings
        6. 17.2.6. Friendly date formats for older browsers
        7. 17.2.7. More conversions
        8. 17.2.8. Date and time arithmetic
        9. 17.2.9. Counting the days . . .
        10. 17.2.10. Early browser date bugs and gremlins
      3. 17.3. Validating Date Entries in Forms
    4. 18. The Array Object
      1. 18.1. Structured Data
      2. 18.2. Creating an Empty Array
      3. 18.3. Populating an Array
      4. 18.4. JavaScript Array Creation Enhancements
      5. 18.5. Deleting Array Entries
      6. 18.6. Parallel Arrays
      7. 18.7. Multidimensional Arrays
      8. 18.8. Simulating a Hash Table
      9. 18.9. Array Object
        1. 18.9.1. Array object properties
          1. 18.9.1.1. Example
        2. 18.9.2. Array object methods
          1. 18.9.2.1. Example
          2. 18.9.2.2. Example
          3. 18.9.2.3. Example
          4. 18.9.2.4. Example
          5. 18.9.2.5. Example
      10. 18.10. Array Comprehensions
      11. 18.11. Destructuring Assignment
      12. 18.12. Compatibility with Older Browsers
    5. 19. JSON—Native JavaScript Object Notation
      1. 19.1. How JSON Works
        1. 19.1.1. Data types
      2. 19.2. Sending and Receiving JSON Data
        1. 19.2.1. JSON goes native
      3. 19.3. JSON Object
        1. 19.3.1. Methods
      4. 19.4. Security Concerns
    6. 20. E4X—Native XML Processing
      1. 20.1. XML
      2. 20.2. ECMAScript for XML (E4X)
        1. 20.2.1. Using the XML object
          1. 20.2.1.1. XML elements
          2. 20.2.1.2. Adding elements
          3. 20.2.1.3. Embedded JavaScript expressions
          4. 20.2.1.4. XML element attributes
          5. 20.2.1.5. The XMLList object
          6. 20.2.1.6. Adding list items
          7. 20.2.1.7. Selecting list items
          8. 20.2.1.8. Serializing XML objects
        2. 20.2.2. Embedding E4X in HTML
        3. 20.2.3. Methods
    7. 21. Control Structures and Exception Handling
      1. 21.1. If and If. . .Else Decisions
        1. 21.1.1. Simple decisions
        2. 21.1.2. About (condition) expressions
        3. 21.1.3. Complex decisions
        4. 21.1.4. Nesting if. . .else statements
      2. 21.2. Conditional Expressions
      3. 21.3. The switch Statement
      4. 21.4. Repeat (for) Loops
        1. 21.4.1. Putting the loop counter to work
        2. 21.4.2. Breaking out of a loop
        3. 21.4.3. Directing loop traffic with continue
      5. 21.5. The while Loop
      6. 21.6. The do-while Loop
      7. 21.7. Looping through Properties (for-in)
      8. 21.8. The with Statement
      9. 21.9. Labeled Statements
      10. 21.10. Exception Handling
        1. 21.10.1. Exceptions and errors
        2. 21.10.2. The exception mechanism
      11. 21.11. Using try-catch-finally Constructions
        1. 21.11.1. Real-life exceptions
      12. 21.12. Throwing Exceptions
      13. 21.13. Error Object
        1. 21.13.1. Syntax
        2. 21.13.2. About this object
        3. 21.13.3. Properties
        4. 21.13.4. Methods
    8. 22. JavaScript Operators
      1. 22.1. Operator Categories
      2. 22.2. Comparison Operators
      3. 22.3. Equality of Disparate Data Types
      4. 22.4. Connubial Operators
      5. 22.5. Assignment Operators
      6. 22.6. Boolean Operators
        1. 22.6.1. Boolean math
        2. 22.6.2. Boolean operators at work
      7. 22.7. Bitwise Operators
        1. 22.7.1.
          1. 22.7.1.1. Example
      8. 22.8. Object Operators
        1. 22.8.1.
          1. 22.8.1.1. Example
          2. 22.8.1.2. Example
          3. 22.8.1.3. Example
          4. 22.8.1.4. Example
      9. 22.9. Miscellaneous Operators
        1. 22.9.1.
          1. 22.9.1.1. Example
          2. 22.9.1.2. Example
      10. 22.10. Operator Precedence
    9. 23. Function Objects and Custom Objects
      1. 23.1. Function Object
        1. 23.1.1. Syntax
        2. 23.1.2. About this object
        3. 23.1.3. Creating functions
        4. 23.1.4. Nesting functions
        5. 23.1.5. Function parameters
        6. 23.1.6. Properties
          1. 23.1.6.1. Example
          2. 23.1.6.2. Example
        7. 23.1.7. Methods
          1. 23.1.7.1. Example
      2. 23.2. Function Application Notes
        1. 23.2.1. Invoking functions
        2. 23.2.2. Variable scope: Globals and locals
        3. 23.2.3. Parameter variables
        4. 23.2.4. Recursion in functions
        5. 23.2.5. Turning functions into libraries
        6. 23.2.6. Making sense of closures
      3. 23.3. Creating Your Own Objects with Object-Oriented JavaScript
        1. 23.3.1. The nuts and bolts of objects
          1. 23.3.1.1. Creating properties for custom objects
          2. 23.3.1.2. Creating methods for custom objects
        2. 23.3.2. An OO example—planetary objects
        3. 23.3.3. Further encapsulation
        4. 23.3.4. Creating an array of objects
        5. 23.3.5. Taking advantage of embedded objects
        6. 23.3.6. The current way to create objects
        7. 23.3.7. Defining object property getters and setters
      4. 23.4. Object-Oriented Concepts
        1. 23.4.1. Adding a prototype
        2. 23.4.2. Prototype inheritance
        3. 23.4.3. Nested objects and prototype inheritance
      5. 23.5. Object Object
        1. 23.5.1. Syntax
        2. 23.5.2. About this object
        3. 23.5.3. Properties
        4. 23.5.4. Methods
    10. 24. Global Functions and Statements
      1. 24.1. Functions
        1. 24.1.1.
          1. 24.1.1.1. Example
          2. 24.1.1.2. Example
          3. 24.1.1.3. Example
          4. 24.1.1.4. Example
          5. 24.1.1.5. Example
      2. 24.2. Statements
        1. 24.2.1.
          1. 24.2.1.1. Example
      3. 24.3. WinIE Objects
  10. IV. Document Objects Reference
    1. 25. Document Object Model Essentials
      1. 25.1. The Object Model Hierarchy
        1. 25.1.1. Hierarchy as road map
        2. 25.1.2. The first browser document object road map
      2. 25.2. How Document Objects Are Born
      3. 25.3. Object Properties
      4. 25.4. Object Methods
      5. 25.5. Object Event Handlers
      6. 25.6. Object Model Smorgasbord
      7. 25.7. Basic Object Model
      8. 25.8. Basic Object Model Plus Images
      9. 25.9. Navigator 4–Only Extensions
        1. 25.9.1. Event capture model
        2. 25.9.2. Layers
      10. 25.10. Internet Explorer 4+ Extensions
        1. 25.10.1. HTML element objects
        2. 25.10.2. Element containment hierarchy
        3. 25.10.3. Cascading Style Sheets
        4. 25.10.4. Event bubbling
      11. 25.11. Internet Explorer 5+ Extensions
      12. 25.12. The W3C DOM
        1. 25.12.1. DOM levels
        2. 25.12.2. What stays the same
        3. 25.12.3. What isn't available
        4. 25.12.4. New HTML practices
        5. 25.12.5. New DOM concepts
          1. 25.12.5.1. Element referencing
          2. 25.12.5.2. A hierarchy of nodes
          3. 25.12.5.3. Node properties
          4. 25.12.5.4. Node methods
          5. 25.12.5.5. Generating new node content
          6. 25.12.5.6. Replacing node content
          7. 25.12.5.7. A de facto standard: innerHTML
        6. 25.12.6. Static W3C DOM HTML objects
        7. 25.12.7. Bidirectional event model
      13. 25.13. Scripting Trends
        1. 25.13.1. Separating content from scripting
        2. 25.13.2. Using the W3C DOM where possible
        3. 25.13.3. Handling events
      14. 25.14. Standards Compatibility Modes (DOCTYPE Switching)
      15. 25.15. Where to Go from Here
    2. 26. Generic HTML Element Objects
      1. 26.1. Generic Objects
        1. 26.1.1. Syntax
        2. 26.1.2. About these objects
        3. 26.1.3. Properties
          1. 26.1.3.1. Example
          2. 26.1.3.2. Example
          3. 26.1.3.3. Example
          4. 26.1.3.4. Example
          5. 26.1.3.5. Example
          6. 26.1.3.6. Example
          7. 26.1.3.7. Example
          8. 26.1.3.8. Example
          9. 26.1.3.9. Example
          10. 26.1.3.10. Example
          11. 26.1.3.11. Example
          12. 26.1.3.12. Example
          13. 26.1.3.13. Example
          14. 26.1.3.14. Example
          15. 26.1.3.15. Example
          16. 26.1.3.16. Example
          17. 26.1.3.17. Example
          18. 26.1.3.18. Example
          19. 26.1.3.19. Example
          20. 26.1.3.20. Example
          21. 26.1.3.21. Example
          22. 26.1.3.22. Example
          23. 26.1.3.23. Example
          24. 26.1.3.24. Example
          25. 26.1.3.25. Example
          26. 26.1.3.26. Example
          27. 26.1.3.27. Example
          28. 26.1.3.28. Example
          29. 26.1.3.29. Example
          30. 26.1.3.30. Example
          31. 26.1.3.31. Example
          32. 26.1.3.32. Example
          33. 26.1.3.33. Example
          34. 26.1.3.34. Example
          35. 26.1.3.35. Example
          36. 26.1.3.36. Example
          37. 26.1.3.37. Example
          38. 26.1.3.38. Example
          39. 26.1.3.39. Example
          40. 26.1.3.40. Example
          41. 26.1.3.41. Example
          42. 26.1.3.42. Example
          43. 26.1.3.43. Example
          44. 26.1.3.44. Example
          45. 26.1.3.45. Example
          46. 26.1.3.46. Example
          47. 26.1.3.47. Example
          48. 26.1.3.48. Example
          49. 26.1.3.49. Example
          50. 26.1.3.50. Example
        4. 26.1.4. Methods
          1. 26.1.4.1. Example
          2. 26.1.4.2. Example
          3. 26.1.4.3. Example
          4. 26.1.4.4. Example
          5. 26.1.4.5. Example
          6. 26.1.4.6. Windows
          7. 26.1.4.7. Form control elements
          8. 26.1.4.8. Other elements
          9. 26.1.4.9. Example
          10. 26.1.4.10. Example
          11. 26.1.4.11. Example
          12. 26.1.4.12. Example
          13. 26.1.4.13. Example
          14. 26.1.4.14. Example
          15. 26.1.4.15. Example
          16. 26.1.4.16. Example
          17. 26.1.4.17. Example
          18. 26.1.4.18. Example
          19. 26.1.4.19. Example
          20. 26.1.4.20. Example
          21. 26.1.4.21. Example
          22. 26.1.4.22. Example
          23. 26.1.4.23. Example
          24. 26.1.4.24. Example
          25. 26.1.4.25. Example
          26. 26.1.4.26. Example
          27. 26.1.4.27. Example
          28. 26.1.4.28. Example
          29. 26.1.4.29. Example
          30. 26.1.4.30. Example
          31. 26.1.4.31. Example
          32. 26.1.4.32. Example
          33. 26.1.4.33. Example
          34. 26.1.4.34. Example
          35. 26.1.4.35. Example
          36. 26.1.4.36. Example
          37. 26.1.4.37. Example
          38. 26.1.4.38. Example
          39. 26.1.4.39. Example
          40. 26.1.4.40. Example
          41. 26.1.4.41. Example
          42. 26.1.4.42. Example
          43. 26.1.4.43. Example
          44. 26.1.4.44. Example
          45. 26.1.4.45. Example
          46. 26.1.4.46. Example
          47. 26.1.4.47. Example
        5. 26.1.5. Event handlers
          1. 26.1.5.1. Example
          2. 26.1.5.2. Example
          3. 26.1.5.3. Example
          4. 26.1.5.4. Example
          5. 26.1.5.5. Example
          6. 26.1.5.6. Example
          7. 26.1.5.7. Example
          8. 26.1.5.8. Example
          9. 26.1.5.9. Example
          10. 26.1.5.10. Example
          11. 26.1.5.11. Example
          12. 26.1.5.12. Example
          13. 26.1.5.13. Example
          14. 26.1.5.14. Example
          15. 26.1.5.15. Example
          16. 26.1.5.16. Example
        6. 26.1.6. Common keyboard event tasks
          1. 26.1.6.1. Example
          2. 26.1.6.2. Example
          3. 26.1.6.3. Example
          4. 26.1.6.4. Example
          5. 26.1.6.5. Example
          6. 26.1.6.6. Example
          7. 26.1.6.7. Example
          8. 26.1.6.8. Example
          9. 26.1.6.9. Example
          10. 26.1.6.10. Example
    3. 27. Window and Frame Objects
      1. 27.1. Window Terminology
      2. 27.2. Frames
        1. 27.2.1. Creating frames
        2. 27.2.2. The frame object model
        3. 27.2.3. Referencing frames
        4. 27.2.4. Top versus parent
        5. 27.2.5. Preventing framing
        6. 27.2.6. Ensuring framing
        7. 27.2.7. Switching from frames to frameless
        8. 27.2.8. Inheritance versus containment
        9. 27.2.9. Frame synchronization
        10. 27.2.10. Blank frames
        11. 27.2.11. Viewing frame source code
        12. 27.2.12. Frames versus frame element objects
      3. 27.3. window Object
        1. 27.3.1. Syntax
        2. 27.3.2. About this object
        3. 27.3.3. Properties
          1. 27.3.3.1. Example
          2. 27.3.3.2. Example
          3. 27.3.3.3. Example
          4. 27.3.3.4. Example
          5. 27.3.3.5. Example
          6. 27.3.3.6. Example
          7. 27.3.3.7. Example
          8. 27.3.3.8. Example
          9. 27.3.3.9. Example
          10. 27.3.3.10. Example
          11. 27.3.3.11. Example
          12. 27.3.3.12. Example
          13. 27.3.3.13. Example
          14. 27.3.3.14. Example
          15. 27.3.3.15. Example
          16. 27.3.3.16. Example
          17. 27.3.3.17. Example
          18. 27.3.3.18. Example
          19. 27.3.3.19. Example
          20. 27.3.3.20. Example
          21. 27.3.3.21. Example
          22. 27.3.3.22. Example
          23. 27.3.3.23. Example
        4. 27.3.4. Methods
          1. 27.3.4.1. Example
          2. 27.3.4.2. Example
          3. 27.3.4.3. Example
          4. 27.3.4.4. Example
          5. 27.3.4.5. Example
          6. 27.3.4.6. Example
          7. 27.3.4.7. Example
          8. 27.3.4.8. Example
          9. 27.3.4.9. Example
          10. 27.3.4.10. Example
          11. 27.3.4.11. Setting new window features
          12. 27.3.4.12. Netscape/Mozilla-only signed scripts
          13. 27.3.4.13. Specifying a window name
          14. 27.3.4.14. Loading content into a new window
          15. 27.3.4.15. Internet Explorer idiosyncrasies
          16. 27.3.4.16. Example
          17. 27.3.4.17. Example
          18. 27.3.4.18. Example
          19. 27.3.4.19. Example
          20. 27.3.4.20. Example
          21. 27.3.4.21. Passing function parameters
          22. 27.3.4.22. Example
          23. 27.3.4.23. Example
          24. 27.3.4.24. Retrieving dialog-box data
          25. 27.3.4.25. Dialog-box window features
          26. 27.3.4.26. Dialog-box cautions
          27. 27.3.4.27. Example
          28. 27.3.4.28. Example
        5. 27.3.5. Event handlers
          1. 27.3.5.1. Example
          2. 27.3.5.2. Example
          3. 27.3.5.3. Example
          4. 27.3.5.4. Example
      4. 27.4. frame Element Object
        1. 27.4.1. Syntax
        2. 27.4.2. About this object
        3. 27.4.3. Properties
          1. 27.4.3.1. Example
          2. 27.4.3.2. Example
          3. 27.4.3.3. Example
          4. 27.4.3.4. Example
          5. 27.4.3.5. Example
          6. 27.4.3.6. Example
          7. 27.4.3.7. Example
          8. 27.4.3.8. Example
      5. 27.5. frameset Element Object
        1. 27.5.1. Syntax
        2. 27.5.2. About this object
        3. 27.5.3. Properties
          1. 27.5.3.1. Example
          2. 27.5.3.2. Example
          3. 27.5.3.3. Example
          4. 27.5.3.4. Example
          5. 27.5.3.5. Example
      6. 27.6. iframe Element Object
        1. 27.6.1. Syntax
        2. 27.6.2. About this object
        3. 27.6.3. Properties
          1. 27.6.3.1. Example
          2. 27.6.3.2. Example
          3. 27.6.3.3. Example
          4. 27.6.3.4. Example
      7. 27.7. popup Object
        1. 27.7.1. Syntax
        2. 27.7.2. About this object
        3. 27.7.3. Properties
          1. 27.7.3.1. Example
          2. 27.7.3.2. Example
        4. 27.7.4. Methods
          1. 27.7.4.1. Example
    4. 28. Location and History Objects
      1. 28.1. location Object
        1. 28.1.1. Syntax
        2. 28.1.2. About this object
        3. 28.1.3. Properties
          1. 28.1.3.1. Passing data between pages via URLs
        4. 28.1.4. Methods
      2. 28.2. history Object
        1. 28.2.1. Syntax
        2. 28.2.2. About this object
        3. 28.2.3. Properties
        4. 28.2.4. Methods
    5. 29. Document and Body Objects
      1. 29.1. document Object
        1. 29.1.1. Syntax
        2. 29.1.2. About this object
        3. 29.1.3. Properties
          1. 29.1.3.1. Example
          2. 29.1.3.2. Example
          3. 29.1.3.3. Example
          4. 29.1.3.4. Example
          5. 29.1.3.5. Example
          6. 29.1.3.6. Example
          7. 29.1.3.7. Example
          8. 29.1.3.8. Example
          9. 29.1.3.9. The cookie file
          10. 29.1.3.10. A cookie record
          11. 29.1.3.11. JavaScript access
          12. 29.1.3.12. Saving cookies
          13. 29.1.3.13. Name/Data
          14. 29.1.3.14. Expires
          15. 29.1.3.15. Path
          16. 29.1.3.16. Domain
          17. 29.1.3.17. SECURE
          18. 29.1.3.18. Retrieving cookie data
          19. 29.1.3.19. Extra batches
          20. 29.1.3.20. Example
          21. 29.1.3.21. Example
          22. 29.1.3.22. Example
          23. 29.1.3.23. Example
          24. 29.1.3.24. Example
          25. 29.1.3.25. Example
          26. 29.1.3.26. Example
          27. 29.1.3.27. Example
          28. 29.1.3.28. Example
          29. 29.1.3.29. Example
          30. 29.1.3.30. Example
          31. 29.1.3.31. Example
          32. 29.1.3.32. Example
          33. 29.1.3.33. Example
          34. 29.1.3.34. Example
          35. 29.1.3.35. Example
          36. 29.1.3.36. Example
          37. 29.1.3.37. Example
          38. 29.1.3.38. Example
        4. 29.1.4. Methods
          1. 29.1.4.1. Example
          2. 29.1.4.2. Example
          3. 29.1.4.3. Example
          4. 29.1.4.4. Example
          5. 29.1.4.5. Example
          6. 29.1.4.6. Example
          7. 29.1.4.7. Example
          8. 29.1.4.8. Example
          9. 29.1.4.9. Example
          10. 29.1.4.10. Example
          11. 29.1.4.11. Example
          12. 29.1.4.12. Example
          13. 29.1.4.13. Example
          14. 29.1.4.14. Example
          15. 29.1.4.15. Example
        5. 29.1.5. Event handlers
          1. 29.1.5.1. Example
      2. 29.2. body Element Object
        1. 29.2.1. Syntax
        2. 29.2.2. About this object
        3. 29.2.3. Properties
          1. 29.2.3.1. Example
          2. 29.2.3.2. Example
          3. 29.2.3.3. Example
          4. 29.2.3.4. Example
          5. 29.2.3.5. Example
        4. 29.2.4. Methods
          1. 29.2.4.1. Example
          2. 29.2.4.2. Example
        5. 29.2.5. Event handlers
      3. 29.3. TreeWalker Object
        1. 29.3.1. Syntax
        2. 29.3.2. About this object
        3. 29.3.3. Properties
          1. 29.3.3.1. Example
        4. 29.3.4. Methods
          1. 29.3.4.1. Example
          2. 29.3.4.2. Example
    6. 30. Link and Anchor Objects
      1. 30.1. Anchor, Link, and a Element Objects
        1. 30.1.1. Syntax
        2. 30.1.2. About this object
        3. 30.1.3. Properties
    7. 31. Image, Area, Map, and Canvas Objects
      1. 31.1. Image and img Element Objects
        1. 31.1.1. Syntax
        2. 31.1.2. About this object
        3. 31.1.3. Properties
          1. 31.1.3.1. Example
          2. 31.1.3.2. Example
          3. 31.1.3.3. Example
          4. 31.1.3.4. Example
          5. 31.1.3.5. Example
          6. 31.1.3.6. Example
          7. 31.1.3.7. Example
          8. 31.1.3.8. Example
          9. 31.1.3.9. Example
          10. 31.1.3.10. Example
          11. 31.1.3.11. Example
          12. 31.1.3.12. Example
          13. 31.1.3.13. Example
        4. 31.1.4. Event handlers
          1. 31.1.4.1. Example
      2. 31.2. area Element Object
        1. 31.2.1. Syntax
        2. 31.2.2. About this object
        3. 31.2.3. Properties
      3. 31.3. map Element Object
        1. 31.3.1. Syntax
        2. 31.3.2. About this object
        3. 31.3.3. Properties
      4. 31.4. canvas Element Object
        1. 31.4.1. Syntax
        2. 31.4.2. About this object
        3. 31.4.3. Properties
          1. 31.4.3.1. Example
          2. 31.4.3.2. Example
          3. 31.4.3.3. Example
          4. 31.4.3.4. Example
          5. 31.4.3.5. Example
          6. 31.4.3.6. Example
        4. 31.4.4. Methods
    8. 32. Event Objects
      1. 32.1. Why "Events"?
        1. 32.1.1. What an event knows (and when it knows it)
        2. 32.1.2. The static Event object
      2. 32.2. Event Propagation
        1. 32.2.1. NN4-only event propagation
          1. 32.2.1.1. Enabling NN4 event capture
          2. 32.2.1.2. Turning off event capture
          3. 32.2.1.3. Passing events toward their targets
          4. 32.2.1.4. Event traffic cop
        2. 32.2.2. IE4+ event propagation
          1. 32.2.2.1. Preventing IE event bubbling
          2. 32.2.2.2. Preventing IE event default action
          3. 32.2.2.3. Redirecting events
          4. 32.2.2.4. Applying event capture
        3. 32.2.3. W3C event propagation
          1. 32.2.3.1. Preventing W3C event bubbling or capture
          2. 32.2.3.2. Preventing W3C event default action
          3. 32.2.3.3. Redirecting W3C DOM events
      3. 32.3. Referencing the event Object
      4. 32.4. Binding Events
        1. 32.4.1. Binding events through tag attributes
        2. 32.4.2. Binding events through object properties
        3. 32.4.3. Binding events through IE attachments
        4. 32.4.4. Binding events through W3C listeners
        5. 32.4.5. A cross-browser event binding solution
      5. 32.5. event Object Compatibility
      6. 32.6. Dueling Event Models
        1. 32.6.1. Cross-platform modifier key check
        2. 32.6.2. Cross-platform key capture
      7. 32.7. Event Types
        1. 32.7.1. Event types in IE4+ and NN6+/W3C
        2. 32.7.2. Syntax
        3. 32.7.3. About this object
        4. 32.7.4. Properties
          1. 32.7.4.1. Example
          2. 32.7.4.2. Example
          3. 32.7.4.3. Example
          4. 32.7.4.4. Example
          5. 32.7.4.5. Example
          6. 32.7.4.6. Example
          7. 32.7.4.7. Example
          8. 32.7.4.8. Example
          9. 32.7.4.9. Example
          10. 32.7.4.10. Example
          11. 32.7.4.11. Example
      8. 32.8. NN6+/Moz event Object
        1. 32.8.1. Syntax
        2. 32.8.2. About this object
        3. 32.8.3. Properties
          1. 32.8.3.1. Example
          2. 32.8.3.2. Example
          3. 32.8.3.3. Example
          4. 32.8.3.4. Example
          5. 32.8.3.5. Example
          6. 32.8.3.6. Example
          7. 32.8.3.7. Example
          8. 32.8.3.8. Example
          9. 32.8.3.9. Example
          10. 32.8.3.10. Example
        4. 32.8.4. Methods
  11. V. Appendixes
    1. A. JavaScript and Browser Objects Quick Reference
    2. B. What's on the CD-ROM
      1. B.1. System Requirements
      2. B.2. Disc Contents
        1. B.2.1. JavaScript listings for text editors
        2. B.2.2. Printable version of the JavaScript and Browser Object Quick Reference from Appendix A
        3. B.2.3. Adobe Reader
          1. B.2.3.1. For Windows
          2. B.2.3.2. For Macintosh
        4. B.2.4. PDF version of book with topical references
      3. B.3. Troubleshooting
      4. B.4. Customer Care
  12. VI. Document Objects Reference (continued)
    1. 33. Body Text Objects
      1. 33.1. blockquote and q Element Objects
        1. 33.1.1. Syntax
        2. 33.1.2. About these objects
        3. 33.1.3. Property
      2. 33.2. br Element Object
        1. 33.2.1. Syntax
        2. 33.2.2. About this object
        3. 33.2.3. Property
      3. 33.3. font Element Object
        1. 33.3.1. Syntax
        2. 33.3.2. About this object
        3. 33.3.3. Properties
          1. 33.3.3.1. Example
          2. 33.3.3.2. Example
          3. 33.3.3.3. Example
      4. 33.4. h1...h6 Element Objects
        1. 33.4.1. Syntax
        2. 33.4.2. About these objects
        3. 33.4.3. Property
      5. 33.5. hr Element Object
        1. 33.5.1. Syntax
        2. 33.5.2. About this object
        3. 33.5.3. Properties
          1. 33.5.3.1. Example
          2. 33.5.3.2. Example
          3. 33.5.3.3. Example
          4. 33.5.3.4. Example
          5. 33.5.3.5. Example
      6. 33.6. label Element Object
        1. 33.6.1. Syntax
        2. 33.6.2. About this object
        3. 33.6.3. Properties
          1. 33.6.3.1. Example
      7. 33.7. marquee Element Object
        1. 33.7.1. Syntax
        2. 33.7.2. About this object
        3. 33.7.3. Properties
          1. 33.7.3.1. Example
          2. 33.7.3.2. Example
          3. 33.7.3.3. Example
          4. 33.7.3.4. Example
        4. 33.7.4. Methods
          1. 33.7.4.1. Example
        5. 33.7.5. Event Handlers
      8. 33.8. Range Object
        1. 33.8.1. Syntax
        2. 33.8.2. About this object
        3. 33.8.3. Working with ranges
        4. 33.8.4. Properties
          1. 33.8.4.1. Example
          2. 33.8.4.2. Example
          3. 33.8.4.3. Example
          4. 33.8.4.4. Example
        5. 33.8.5. Methods
          1. 33.8.5.1. Example
          2. 33.8.5.2. Example
          3. 33.8.5.3. Example
          4. 33.8.5.4. Example
          5. 33.8.5.5. Example
          6. 33.8.5.6. Example
          7. 33.8.5.7. Example
          8. 33.8.5.8. Example
          9. 33.8.5.9. Example
          10. 33.8.5.10. Example
          11. 33.8.5.11. Example
      9. 33.9. selection Object
        1. 33.9.1. Syntax
        2. 33.9.2. About this object
        3. 33.9.3. Properties
          1. 33.9.3.1. Example
        4. 33.9.4. Methods
          1. 33.9.4.1. Example
          2. 33.9.4.2. Example
          3. 33.9.4.3. Example
      10. 33.10. Text and TextNode Objects
        1. 33.10.1. Syntax
        2. 33.10.2. About this object
        3. 33.10.3. Properties
          1. 33.10.3.1. Example
        4. 33.10.4. Methods
          1. 33.10.4.1. Example
          2. 33.10.4.2. Example
      11. 33.11. TextRange Object
        1. 33.11.1. Syntax
        2. 33.11.2. About this object
        3. 33.11.3. Working with text ranges
        4. 33.11.4. About browser compatibility
        5. 33.11.5. Properties
          1. 33.11.5.1. Example
          2. 33.11.5.2. Example
          3. 33.11.5.3. Example
        6. 33.11.6. Methods
          1. 33.11.6.1. Example
          2. 33.11.6.2. Example
          3. 33.11.6.3. Example
          4. 33.11.6.4. Example
          5. 33.11.6.5. Example
          6. 33.11.6.6. Example
          7. 33.11.6.7. Example
          8. 33.11.6.8. Example
          9. 33.11.6.9. Example
          10. 33.11.6.10. Example
          11. 33.11.6.11. Example
          12. 33.11.6.12. Example
          13. 33.11.6.13. Example
          14. 33.11.6.14. Example
          15. 33.11.6.15. Example
          16. 33.11.6.16. Example
          17. 33.11.6.17. Example
          18. 33.11.6.18. Example
      12. 33.12. TextRectangle Object
        1. 33.12.1. Syntax
        2. 33.12.2. About this object
        3. 33.12.3. Properties
          1. 33.12.3.1. Example
    2. 34. The Form and Related Objects
      1. 34.1. The Form in the Object Hierarchy
      2. 34.2. form Object
        1. 34.2.1. Syntax
        2. 34.2.2. About this object
        3. 34.2.3. References to form control elements
        4. 34.2.4. Passing forms and elements to functions
        5. 34.2.5. Emailing forms
        6. 34.2.6. Changing form attributes
        7. 34.2.7. Buttons in forms
        8. 34.2.8. Redirection after submission
        9. 34.2.9. Form element arrays
        10. 34.2.10. About <input> element objects
        11. 34.2.11. Properties
        12. 34.2.12. Methods
        13. 34.2.13. Event handlers
      3. 34.3. fieldset and legend Element Objects
        1. 34.3.1. Syntax
        2. 34.3.2. About these objects
      4. 34.4. label Element Object
        1. 34.4.1. Syntax
        2. 34.4.2. About this object
        3. 34.4.3. Properties
      5. 34.5. Scripting and Web Forms 2.0
        1. 34.5.1. What Is Web Forms 2.0?
        2. 34.5.2. Web Forms 2.0 and JavaScript
    3. 35. Button Objects
      1. 35.1. The button Element Object, and the Button, Submit, and Reset Input Objects
        1. 35.1.1. Syntax
        2. 35.1.2. About these objects
        3. 35.1.3. Properties
        4. 35.1.4. Methods
        5. 35.1.5. Event handlers
      2. 35.2. checkbox Input Object
        1. 35.2.1. Syntax
        2. 35.2.2. About this object
        3. 35.2.3. Properties
        4. 35.2.4. Methods
        5. 35.2.5. Event handlers
      3. 35.3. radio Input Object
        1. 35.3.1. Syntax
        2. 35.3.2. About this object
        3. 35.3.3. Properties
        4. 35.3.4. Methods
        5. 35.3.5. Event handlers
      4. 35.4. image Input Object
        1. 35.4.1. Syntax
        2. 35.4.2. About this object
        3. 35.4.3. Properties
    4. 36. Text-Related Form Objects
      1. 36.1. Text Input Object
        1. 36.1.1. Syntax
        2. 36.1.2. About this object
        3. 36.1.3. Text fields and events
        4. 36.1.4. Properties
        5. 36.1.5. Methods
        6. 36.1.6. Event handlers
      2. 36.2. password Input Object
        1. 36.2.1. Syntax
        2. 36.2.2. About this object
      3. 36.3. hidden Input Object
        1. 36.3.1. Syntax
        2. 36.3.2. About this object
      4. 36.4. textarea Element Object
        1. 36.4.1. Syntax
        2. 36.4.2. About this object
        3. 36.4.3. Carriage returns inside textareas
        4. 36.4.4. Properties
        5. 36.4.5. Methods
    5. 37. Select, Option, and FileUpload Objects
      1. 37.1. select Element Object
        1. 37.1.1. Syntax
        2. 37.1.2. About this object
        3. 37.1.3. Modifying select options (NN3, IE4)
        4. 37.1.4. Modifying select options (IE4+)
        5. 37.1.5. Modifying select options (W3C DOM)
        6. 37.1.6. Properties
        7. 37.1.7. Methods
        8. 37.1.8. Event handlers
      2. 37.2. option Element Object
        1. 37.2.1. Syntax
        2. 37.2.2. About this object
        3. 37.2.3. Properties
      3. 37.3. optgroup Element Object
        1. 37.3.1. Syntax
        2. 37.3.2. About this object
        3. 37.3.3. Properties
      4. 37.4. file Input Element Object
        1. 37.4.1. Syntax
        2. 37.4.2. About this object
    6. 38. Style Sheet and Style Objects
      1. 38.1. Making Sense of the Object Names
      2. 38.2. Imported Style Sheets
      3. 38.3. Reading Style Properties
      4. 38.4. style Element Object
        1. 38.4.1. Syntax
        2. 38.4.2. About this object
        3. 38.4.3. Properties
      5. 38.5. styleSheet Object
        1. 38.5.1. Syntax
        2. 38.5.2. About this object
        3. 38.5.3. Properties
          1. 38.5.3.1. Example
          2. 38.5.3.2. Example
          3. 38.5.3.3. Example
          4. 38.5.3.4. Example
          5. 38.5.3.5. Example
          6. 38.5.3.6. Example
        4. 38.5.4. Methods
          1. 38.5.4.1. Example
          2. 38.5.4.2. Example
      6. 38.6. cssRule and rule Objects
        1. 38.6.1. Syntax
        2. 38.6.2. About these objects
        3. 38.6.3. Properties
          1. 38.6.3.1. Example
          2. 38.6.3.2. Example
      7. 38.7. currentStyle, runtimeStyle, and style Objects
        1. 38.7.1. Syntax
        2. 38.7.2. About these objects
        3. 38.7.3. Style properties
        4. 38.7.4. Property values
          1. 38.7.4.1. Length
          2. 38.7.4.2. Color
          3. 38.7.4.3. Rectangle sides
          4. 38.7.4.4. Combination values
          5. 38.7.4.5. URLs
        5. 38.7.5. Text and font properties
        6. 38.7.6. Inline display and layout properties
        7. 38.7.7. Positioning properties
        8. 38.7.8. Background properties
        9. 38.7.9. Border and edge properties
        10. 38.7.10. List properties
        11. 38.7.11. Scroll bar properties
        12. 38.7.12. Table properties
        13. 38.7.13. Page and printing properties
        14. 38.7.14. Miscellaneous properties
        15. 38.7.15. Aural properties
      8. 38.8. filter Object
        1. 38.8.1. Syntax
        2. 38.8.2. About this object
          1. 38.8.2.1. Reading and writing subproperties
        3. 38.8.3. WinIE5.5+ filter syntax changes
    7. 39. Ajax, E4X, and XML
      1. 39.1. Elements and Nodes
      2. 39.2. xml Element Object
        1. 39.2.1. Syntax
        2. 39.2.2. About this object
        3. 39.2.3. Properties
      3. 39.3. XMLHttpRequest Object
        1. 39.3.1. Syntax
        2. 39.3.2. About this object
        3. 39.3.3. Properties
        4. 39.3.4. Methods
      4. 39.4. ECMAScript for XML (E4X)
        1. 39.4.1. Methods
    8. 40. HTML Directive Objects
      1. 40.1. HTML Element Object
        1. 40.1.1. Syntax
        2. 40.1.2. About this object
        3. 40.1.3. Property
      2. 40.2. head Element Object
        1. 40.2.1. Syntax
        2. 40.2.2. About this object
        3. 40.2.3. Property
      3. 40.3. base Element Object
        1. 40.3.1. Syntax
        2. 40.3.2. About this object
        3. 40.3.3. Properties
      4. 40.4. link Element Object
        1. 40.4.1. Syntax
        2. 40.4.2. About this object
        3. 40.4.3. Properties
        4. 40.4.4. Event handlers
      5. 40.5. meta Element Object
        1. 40.5.1. Syntax
        2. 40.5.2. About this object
        3. 40.5.3. Properties
      6. 40.6. script Element Object
        1. 40.6.1. Syntax
        2. 40.6.2. About this object
        3. 40.6.3. Properties
      7. 40.7. title Element Object
        1. 40.7.1. Syntax
        2. 40.7.2. About this object
        3. 40.7.3. Property
    9. 41. Table and List Objects
      1. 41.1. The Table Object Family Hierarchy
        1. 41.1.1. Populating table cells
        2. 41.1.2. Modifying table cell content
        3. 41.1.3. Modifying table rows
        4. 41.1.4. Modifying table columns
        5. 41.1.5. W3C DOM table object classes
      2. 41.2. table Element Object
        1. 41.2.1. Syntax
        2. 41.2.2. About this object
        3. 41.2.3. Properties
          1. 41.2.3.1. Example
          2. 41.2.3.2. Example
          3. 41.2.3.3. Example
          4. 41.2.3.4. Example
          5. 41.2.3.5. Example
          6. 41.2.3.6. Example
          7. 41.2.3.7. Example
          8. 41.2.3.8. Example
          9. 41.2.3.9. Example
          10. 41.2.3.10. Example
          11. 41.2.3.11. Example
          12. 41.2.3.12. Example
          13. 41.2.3.13. Example
          14. 41.2.3.14. Example
        4. 41.2.4. Methods
          1. 41.2.4.1. Example
          2. 41.2.4.2. Example
          3. 41.2.4.3. Example
          4. 41.2.4.4. Example
      3. 41.3. tbody, tfoot, and thead Element Objects
        1. 41.3.1. Syntax
        2. 41.3.2. About these objects
        3. 41.3.3. Properties
          1. 41.3.3.1. Example
      4. 41.4. caption Element Object
        1. 41.4.1. Syntax
        2. 41.4.2. About this object
      5. 41.5. col and colgroup Element Objects
        1. 41.5.1. Syntax
        2. 41.5.2. About these objects
        3. 41.5.3. Properties
          1. 41.5.3.1. Example
      6. 41.6. tr Element Object
        1. 41.6.1. Syntax
        2. 41.6.2. About this object
        3. 41.6.3. Properties
          1. 41.6.3.1. Example
          2. 41.6.3.2. Example
          3. 41.6.3.3. Example
        4. 41.6.4. Methods
          1. 41.6.4.1. Example
      7. 41.7. td and th Element Objects
        1. 41.7.1. Syntax
        2. 41.7.2. About these objects
        3. 41.7.3. Properties
          1. 41.7.3.1. Example
          2. 41.7.3.2. Example
          3. 41.7.3.3. Example
          4. 41.7.3.4. Example
      8. 41.8. ol Element Object
        1. 41.8.1. Syntax
        2. 41.8.2. About this object
        3. 41.8.3. Properties
          1. 41.8.3.1. Example
          2. 41.8.3.2. Example
      9. 41.9. ul Element Object
        1. 41.9.1. Syntax
        2. 41.9.2. About this object
        3. 41.9.3. Properties
          1. 41.9.3.1. Example
      10. 41.10. li Element Object
        1. 41.10.1. Syntax
        2. 41.10.2. About this object
        3. 41.10.3. Properties
          1. 41.10.3.1. Example
          2. 41.10.3.2. Example
      11. 41.11. dl, dt, and dd Element Objects
        1. 41.11.1. Syntax
        2. 41.11.2. About these objects
        3. 41.11.3. Properties
      12. 41.12. dir and menu Element Objects
        1. 41.12.1. Syntax
        2. 41.12.2. About these objects
    10. 42. The Navigator and Other Environment Objects
      1. 42.1. clientInformation Object (IE4+) and navigator Object (All)
        1. 42.1.1. Syntax
        2. 42.1.2. About this object
        3. 42.1.3. Properties
        4. 42.1.4. Using the appVersion property
        5. 42.1.5. userAgent property details
          1. 42.1.5.1. Example
          2. 42.1.5.2. Example
          3. 42.1.5.3. Example
          4. 42.1.5.4. Example
          5. 42.1.5.5. Example
          6. 42.1.5.6. Example
          7. 42.1.5.7. Example
          8. 42.1.5.8. Example
          9. 42.1.5.9. Example
          10. 42.1.5.10. Example
          11. 42.1.5.11. Example
        6. 42.1.6. Methods
          1. 42.1.6.1. Example
      2. 42.2. mimeType Object
        1. 42.2.1. Syntax
        2. 42.2.2. About this object
        3. 42.2.3. Properties
          1. 42.2.3.1. Example
          2. 42.2.3.2. Example
          3. 42.2.3.3. Example
      3. 42.3. plugin Object
        1. 42.3.1. Syntax
        2. 42.3.2. About this object
        3. 42.3.3. Properties
          1. 42.3.3.1. Example
        4. 42.3.4. Methods
      4. 42.4. Looking for mime Types and Plug-Ins
        1. 42.4.1. Overview: Using mimeType and plugin objects
        2. 42.4.2. Verifying a mime type
        3. 42.4.3. Verifying a plug-in
        4. 42.4.4. Verifying both plug-in and mime type
        5. 42.4.5. Managing manual plug-in installation
        6. 42.4.6. "Plug-in" detection in WinIE
          1. 42.4.6.1. Tracking down plug-in details
          2. 42.4.6.2. Setting a minimum version number
          3. 42.4.6.3. When an object requires VBScript
      5. 42.5. screen Object
        1. 42.5.1. Syntax
        2. 42.5.2. About this object
        3. 42.5.3. Properties
          1. 42.5.3.1. Example
      6. 42.6. userProfile Object
        1. 42.6.1. Syntax
        2. 42.6.2. About this object
        3. 42.6.3. Methods
          1. 42.6.3.1. Example
          2. 42.6.3.2. Example
          3. 42.6.3.3. Example
    11. 43. Positioned Objects
      1. 43.1. What Is a Layer?
      2. 43.2. Positioned Elements in the Modern DOM
        1. 43.2.1. Changing element backgrounds
        2. 43.2.2. Layer clipping
        3. 43.2.3. Scripting nested layers
        4. 43.2.4. Loading external HTML into a layer
        5. 43.2.5. Positioned element visibility behavior
        6. 43.2.6. Scripting layer stacking order
        7. 43.2.7. Dragging and resizing a layer
    12. 44. Embedded Objects
      1. 44.1. applet Element Object
        1. 44.1.1. Syntax
        2. 44.1.2. About this object
        3. 44.1.3. Properties
      2. 44.2. object Element Object
        1. 44.2.1. Syntax
        2. 44.2.2. About this object
        3. 44.2.3. Properties
      3. 44.3. embed Element Object
        1. 44.3.1. Syntax
        2. 44.3.2. About this object
        3. 44.3.3. Properties
      4. 44.4. The Odd Case of the param Element
    13. 45. The Regular Expression and RegExp Objects
      1. 45.1. Regular Expressions and Patterns
      2. 45.2. Language Basics
        1. 45.2.1. Simple patterns
        2. 45.2.2. Special characters
        3. 45.2.3. Grouping and backreferencing
      3. 45.3. Object Relationships
      4. 45.4. Using Regular Expressions
        1. 45.4.1. Is there a match?
        2. 45.4.2. Getting information about a match
        3. 45.4.3. String replacement
      5. 45.5. Regular Expression Object
        1. 45.5.1. Syntax
        2. 45.5.2. About this object
        3. 45.5.3. Properties
        4. 45.5.4. Methods
      6. 45.6. RegExp Object
        1. 45.6.1. Syntax
        2. 45.6.2. About this object
        3. 45.6.3. Properties
  13. VII. More JavaScript Programming
    1. 46. Data-Entry Validation
      1. 46.1. Real-Time Versus Batch Validation
        1. 46.1.1. Real-time validation triggers
        2. 46.1.2. Batch mode validation
      2. 46.2. Designing Filters
      3. 46.3. Building a Library of Filter Functions
        1. 46.3.1. isEmpty()
        2. 46.3.2. isPosInteger()
        3. 46.3.3. isInteger()
        4. 46.3.4. isNumber()
        5. 46.3.5. Custom validation functions
      4. 46.4. Combining Validation Functions
      5. 46.5. Date and Time Validation
      6. 46.6. An Industrial-Strength Validation Solution
        1. 46.6.1. Structure
        2. 46.6.2. Dispatch mechanism
        3. 46.6.3. Sample validations
          1. 46.6.3.1. U.S. state name
          2. 46.6.3.2. Date validation
          3. 46.6.3.3. Cross-confirmation fields
        4. 46.6.4. Last-minute check
        5. 46.6.5. Try it out
      7. 46.7. Plan for Data Validation
    2. 47. Scripting Java Applets and Plug-Ins
      1. 47.1. NPAPI Overview
      2. 47.2. Why Control Java Applets?
      3. 47.3. A Little Java
        1. 47.3.1. Java building blocks classes
        2. 47.3.2. Java methods
        3. 47.3.3. Java applet "properties"
      4. 47.4. Scripting Applets in Real Life
        1. 47.4.1. Getting to scriptable methods
        2. 47.4.2. Applet limitations
        3. 47.4.3. Faceless applets
        4. 47.4.4. Data type conversions
      5. 47.5. Applet-to-Script Communication
        1. 47.5.1. What your applet needs
        2. 47.5.2. What your HTML needs
        3. 47.5.3. About the JSObject class
        4. 47.5.4. Data type conversions
        5. 47.5.5. Example applet-to-script application
      6. 47.6. Scripting Plug-Ins
        1. 47.6.1. The HTML side
        2. 47.6.2. The API approach
          1. 47.6.2.1. Loading the library
          2. 47.6.2.2. Initializing the library
          3. 47.6.2.3. Sound player API objects
          4. 47.6.2.4. Invoking methods
        3. 47.6.3. Building a jukebox
        4. 47.6.4. Embedding multiple sounds
      7. 47.7. Scripting Java Classes Directly
    3. 48. Debugging Scripts
      1. 48.1. Syntax versus Runtime Errors
      2. 48.2. Error Message Notification
        1. 48.2.1. Mozilla console windows
        2. 48.2.2. Safari errors
        3. 48.2.3. Opera errors
        4. 48.2.4. Chrome errors
        5. 48.2.5. Multiple error messages
      3. 48.3. Error Message Details
        1. 48.3.1. Error filename
        2. 48.3.2. Error location
        3. 48.3.3. Error message text
          1. 48.3.3.1. "Object expected"
          2. 48.3.3.2. "Expected <something>"
          3. 48.3.3.3. "<Something> is undefined"
          4. 48.3.3.4. "<Something> is not a function"
          5. 48.3.3.5. "Object doesn't support this property or method"
          6. 48.3.3.6. "Unterminated string literal"
          7. 48.3.3.7. "Unterminated string constant"
          8. 48.3.3.8. "Missing after function body"
          9. 48.3.3.9. "Expected"
          10. 48.3.3.10. "<Something> is not a number"
          11. 48.3.3.11. "<Something> has no property named . . ."
          12. 48.3.3.12. "<Something> has no properties"
          13. 48.3.3.13. "<Something> is null or not an object"
          14. 48.3.3.14. "<Something> has no property indexed by [i]"
          15. 48.3.3.15. "<Something> can't be set by assignment"
          16. 48.3.3.16. "Test for equality () mistyped as assignment ()? Assuming equality test"
          17. 48.3.3.17. "Function does not always return a value"
          18. 48.3.3.18. "Access disallowed from scripts at <URL> to documents at <URL<" "Access is denied"
          19. 48.3.3.19. "Unspecified error"
          20. 48.3.3.20. "Uncaught exception"
          21. 48.3.3.21. "Too many JavaScript errors"
      4. 48.4. Warnings in Mozilla's Console
      5. 48.5. Sniffing Out Problems
        1. 48.5.1. Check the HTML tags
        2. 48.5.2. View the source
        3. 48.5.3. Timing problems
        4. 48.5.4. Reopen the file
        5. 48.5.5. Find out what works
        6. 48.5.6. Comment out statements
        7. 48.5.7. Check runtime expression evaluation
      6. 48.6. Debugging Tools
        1. 48.6.1. WinIE's Script Debugger
        2. 48.6.2. Mozilla's Venkman Debugger
        3. 48.6.3. Firefox's FireBug Debugger
        4. 48.6.4. WebKit's Drosera Debugger
        5. 48.6.5. Opera's Dragonfly Debugger
        6. 48.6.6. Using the embeddable Evaluator
        7. 48.6.7. Emergency evaluation
      7. 48.7. A Simple Trace Utility
        1. 48.7.1. The trace() function
        2. 48.7.2. Preparing documents for trace.js
        3. 48.7.3. Invoking trace()
      8. 48.8. Browser Crashes
      9. 48.9. Preventing Problems
        1. 48.9.1. Getting structure right
        2. 48.9.2. Build incrementally
        3. 48.9.3. Test expression evaluation
        4. 48.9.4. Build function workbenches
      10. 48.10. Testing Your Masterpiece
    4. 49. Security and Netscape Signed Scripts
      1. 49.1. Battening Down the Hatches
      2. 49.2. When Worlds Collide
      3. 49.3. The Java Sandbox
      4. 49.4. Security Policies
      5. 49.5. The Same Origin Policy
        1. 49.5.1. Setting the document.domain
        2. 49.5.2. Origin checks
          1. 49.5.2.1. Window object checks
          2. 49.5.2.2. Location object checks
          3. 49.5.2.3. Document object checks
          4. 49.5.2.4. Form object checks
          5. 49.5.2.5. Applet object checks
          6. 49.5.2.6. Image object checks
          7. 49.5.2.7. Linked script library checks
      6. 49.6. The Netscape Signed Script Policy
        1. 49.6.1. Signed objects and scripts
        2. 49.6.2. What you get with signed scripts
      7. 49.7. The Digital Certificate
        1. 49.7.1. How to get a certificate
        2. 49.7.2. Activating the codebase principal
      8. 49.8. Signing Scripts
        1. 49.8.1. Signing tool
        2. 49.8.2. Preparing scripts for signing
        3. 49.8.3. Accessing signed scripts
        4. 49.8.4. Editing and moving signed scripts
      9. 49.9. Accessing Protected Properties and Methods
        1. 49.9.1. Gaining privileges
        2. 49.9.2. Specifying a target
      10. 49.10. Adding Privileges to Scripts
        1. 49.10.1. Keep the window small
        2. 49.10.2. Think of the users
      11. 49.11. Examples
        1. 49.11.1. Accessing private browser information
        2. 49.11.2. Accessing a protected window property
      12. 49.12. Handling Privilege Manager Errors
      13. 49.13. Signed Script Miscellany
        1. 49.13.1. Exporting and importing signed scripts
        2. 49.13.2. Locking down your signed pages
        3. 49.13.3. International characters
    5. 50. Cross-Browser Dynamic HTML Issues
      1. 50.1. What Is DHTML?
      2. 50.2. Striving for Compatibility
      3. 50.3. Working Around Incompatibilities
        1. 50.3.1. Old-fashioned compatibility tricks
          1. 50.3.1.1. Inline branching
          2. 50.3.1.2. Platform equivalency
        2. 50.3.2. Modern approaches to compatibility
          1. 50.3.2.1. Object detection
          2. 50.3.2.2. Custom APIs
        3. 50.3.3. Handling non-DHTML browsers
      4. 50.4. A DHTML API Example
    6. 51. Internet Explorer Behaviors
      1. 51.1. Style Sheets for Scripts
      2. 51.2. Embedding Behavior Components
        1. 51.2.1. Linking in a behavior component
        2. 51.2.2. Enabling and disabling behaviors
      3. 51.3. Component Structure
        1. 51.3.1. Script statements
        2. 51.3.2. Variable scope
        3. 51.3.3. Assigning event handlers
        4. 51.3.4. Exposing properties and methods
      4. 51.4. Behavior Examples
        1. 51.4.1. Example 1: Element dragging behavior
        2. 51.4.2. Example 2: Text rollover behavior
      5. 51.5. For More Information
  14. VIII. Applications
    1. 52. Application: Tables and Calendars
      1. 52.1. About the Calendars
      2. 52.2. Static Tables
      3. 52.3. Dynamic Tables
      4. 52.4. Hybrids
      5. 52.5. Dynamic HTML Tables
      6. 52.6. Further Thoughts
    2. 53. Application: A Lookup Table
      1. 53.1. A Server-Less Database
      2. 53.2. The Database
      3. 53.3. The Implementation Plan
      4. 53.4. The Code
      5. 53.5. Further Thoughts
    3. 54. Application: A Poor Man's Order Form
      1. 54.1. Defining the Task
      2. 54.2. The Form Design
      3. 54.3. Form HTML and Scripting
        1. 54.3.1. Global adjustments
        2. 54.3.2. Do the math
        3. 54.3.3. Cooking up some HTML
        4. 54.3.4. Tedium lost
        5. 54.3.5. Tedium regained
      4. 54.4. Further Thoughts
    4. 55. Application: Outline-Style Table of Contents
      1. 55.1. The Implementation Plan
      2. 55.2. The Code
        1. 55.2.1. Setting the frames
        2. 55.2.2. Outline code
        3. 55.2.3. Assembling outline content
      3. 55.3. An Ajax (XML) Outline
        1. 55.3.1. Birth of an XML specification
        2. 55.3.2. OPML outliner prep
        3. 55.3.3. The XML and HTML code
        4. 55.3.4. Setting the scripted stage
        5. 55.3.5. Accumulating the HTML
        6. 55.3.6. Toggling node expansion
        7. 55.3.7. Wrap up
      4. 55.4. Further Thoughts
    5. 56. Application: Calculations and Graphics
      1. 56.1. The Calculation
      2. 56.2. User Interface Ideas
      3. 56.3. The Code
        1. 56.3.1. Basic arrays
        2. 56.3.2. Calculations and formatting
        3. 56.3.3. Preloading images
        4. 56.3.4. Changing images on-the-fly
        5. 56.3.5. Creating the select objects
        6. 56.3.6. Drawing the initial images
      4. 56.4. Further Thoughts
    6. 57. Application: Intelligent "Updated" Flags
      1. 57.1. The Cookie Conundrum
      2. 57.2. Time's Not on Your Side
      3. 57.3. The Application
      4. 57.4. The Code
        1. 57.4.1. Setting the stage
        2. 57.4.2. The date comparison
      5. 57.5. Further Thoughts
    7. 58. Application: Decision Helper
      1. 58.1. The Application
      2. 58.2. The Design
      3. 58.3. The Files
      4. 58.4. The Code
        1. 58.4.1. index.html
        2. 58.4.2. dhNav.html
        3. 58.4.3. dh1.html
        4. 58.4.4. dh2.html
        5. 58.4.5. dh3.html
        6. 58.4.6. dh4.html
        7. 58.4.7. dh5.html
        8. 58.4.8. dhHelp.html
      5. 58.5. Further Thoughts
    8. 59. Application: Cross-Browser DHTML Map Puzzle
      1. 59.1. The Puzzle Design
      2. 59.2. Implementation Details
        1. 59.2.1. The custom API
        2. 59.2.2. The main program
      3. 59.3. Further Thoughts
    9. 60. Application: Transforming XML Data
      1. 60.1. Application Overview
      2. 60.2. Implementation Plan
      3. 60.3. The Code
        1. 60.3.1. Style sheets
        2. 60.3.2. Initialization sequence
        3. 60.3.3. Converting the data
        4. 60.3.4. Sorting the JavaScript database
        5. 60.3.5. Constructing the table
        6. 60.3.6. select controls
      4. 60.4. Further Thoughts
    10. 61. Application: Creating Custom Google Maps
      1. 61.1. A Google Maps Primer
      2. 61.2. Google Maps Customization Basics
        1. 61.2.1. Getting your own API key
        2. 61.2.2. Inside the Google Maps API
        3. 61.2.3. Obtaining the geocoordinates of a location
      3. 61.3. Designing a Google Maps Mashup
      4. 61.4. Developing a Custom Map Document
      5. 61.5. Hacking Together a Custom Google Map
        1. 61.5.1. Displaying the custom map
        2. 61.5.2. Styling a custom information window
        3. 61.5.3. Testing the finished map
      6. 61.6. Further Thoughts
  15. IX. Appendixes (continued)
    1. C. JavaScript Reserved Words
    2. D. Answers to Tutorial Exercises
      1. D.1. Chapter 5 Answers
      2. D.2. Chapter 6 Answers
      3. D.3. Chapter 7 Answers
      4. D.4. Chapter 8 Answers
      5. D.5. Chapter 9 Answers
      6. D.6. Chapter 10 Answers
      7. D.7. Chapter 11 Answers
      8. D.8. Chapter 12 Answers
      9. D.9. Chapter 13 Answers
      10. D.10. Chapter 14 Answers
    3. E. JavaScript and DOM Internet Resources
      1. E.1. Support and Updates for This Book
      2. E.2. FAQs
      3. E.3. Online Documentation
      4. E.4. World Wide Web
      5. E.5. Feeds and Blogs
      6. E.6. Newsgroups and Forums
      7. E.7. Final Thoughts