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

Book Description

Make your Web pages stand out above the noise with JavaScript and the expert instruction in this much-anticipated update to the bestselling JavaScript Bible. With renowned JavaScript expert Danny Goodman at your side, you’ll get a thorough grounding in JavaScript basics, see how it fits with current Web browsers, and find all the soup-to-nuts detail you’ll need. Whether you’re a veteran programmer or just starting out, this is the JavaScript book Web developers turn to again and again.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Credits
  4. Acknowledgments
  5. Foreword
  6. Preface
    1. Organization and Features of This Edition
      1. Part I
      2. Part II
      3. Part III
      4. Part IV
      5. Part V
      6. 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 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
      4. 1.4. JavaScript: The Right Tool for the Right Job
    2. 2. Authoring Challenges Amid the Browser Wars
      1. 2.1. Leapfrog
      2. 2.2. Duck and Cover
      3. 2.3. Compatibility Issues Today
        1. 2.3.1. Separating language from objects
        2. 2.3.2. Core language standard
        3. 2.3.3. Document object model
        4. 2.3.4. Cascading Style Sheets
        5. 2.3.5. Dynamic HTML and positioning
      4. 2.4. Developing a Scripting Strategy
    3. 3. Your First JavaScript Script
      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. What Your First Script Will Do
      4. 3.4. Entering Your First Script
      5. 3.5. Examining the Script
        1. 3.5.1. The HTML document
        2. 3.5.2. The <script> tag
        3. 3.5.3. The trigger that runs the script
        4. 3.5.4. Inserting some text
        5. 3.5.5. Getting browser information
      6. 3.6. Have Some Fun
  8. II. JavaScript Tutorial
    1. 4. Browser and Document Objects
      1. 4.1. Scripts Run the Show
      2. 4.2. When to Use JavaScript
      3. 4.3. The Document Object Model
        1. 4.3.1. HTML structure and the DOM
        2. 4.3.2. The DOM in a browser window
      4. 4.4. When a Document Loads
        1. 4.4.1. A simple document
        2. 4.4.2. Add a paragraph element
        3. 4.4.3. Add paragraph text
        4. 4.4.4. Make a new element
      5. 4.5. Object References
        1. 4.5.1. Object naming
        2. 4.5.2. Referencing a particular object
      6. 4.6. Node Terminology
        1. 4.6.1. About nodes
        2. 4.6.2. Parents and children
      7. 4.7. What Defines an Object?
        1. 4.7.1. Properties
        2. 4.7.2. Methods
        3. 4.7.3. Events
      8. 4.8. Exercises
    2. 5. Scripts and HTML Documents
      1. 5.1. Where Scripts Go in Documents
        1. 5.1.1. The <script> tag
        2. 5.1.2. Tag positions
        3. 5.1.3. Handling non-JavaScript browsers
      2. 5.2. JavaScript Statements
      3. 5.3. When Script Statements Execute
        1. 5.3.1. While a document loads: immediate execution
        2. 5.3.2. Deferred scripts
          1. 5.3.2.1. Run after loading
          2. 5.3.2.2. Run by user
          3. 5.3.2.3. Called by another function
      4. 5.4. Viewing Script Errors
      5. 5.5. Scripting versus Programming
      6. 5.6. Exercises
    3. 6. Programming Fundamentals, Part I
      1. 6.1. What Language Is This?
      2. 6.2. Working with Information
      3. 6.3. Variables
        1. 6.3.1. Creating a variable
        2. 6.3.2. Variable names
      4. 6.4. Expressions and Evaluation
        1. 6.4.1. Expressions in scripts
        2. 6.4.2. Expressions and variables
      5. 6.5. Data Type Conversions
        1. 6.5.1. Converting strings to numbers
        2. 6.5.2. Converting numbers to strings
      6. 6.6. Operators
        1. 6.6.1. Arithmetic operators
        2. 6.6.2. Comparison operators
      7. 6.7. Exercises
    4. 7. Programming Fundamentals, Part II
      1. 7.1. Decisions and Loops
      2. 7.2. Control Structures
        1. 7.2.1. if constructions
        2. 7.2.2. if . . . else constructions
      3. 7.3. About Repeat Loops
      4. 7.4. Functions
        1. 7.4.1. Function parameters
        2. 7.4.2. Variable scope
      5. 7.5. About Curly Braces
      6. 7.6. Arrays
        1. 7.6.1. Creating an array
        2. 7.6.2. Accessing array data
        3. 7.6.3. Parallel arrays
        4. 7.6.4. Document objects in arrays
      7. 7.7. Exercises
    5. 8. Window and Document Objects
      1. 8.1. Top-Level Objects
      2. 8.2. The window Object
        1. 8.2.1. Accessing window properties and methods
        2. 8.2.2. Creating a window
      3. 8.3. Window Properties and Methods
        1. 8.3.1. window.alert() method
        2. 8.3.2. window.confirm() method
        3. 8.3.3. window.prompt() method
        4. 8.3.4. load event
      4. 8.4. The location Object
      5. 8.5. The navigator Object
      6. 8.6. The document Object
        1. 8.6.1. document.forms[] property
        2. 8.6.2. document.images[] property
        3. 8.6.3. document.write() method
        4. 8.6.4. document.createElement() and document.createTextNode() methods
        5. 8.6.5. document.getElementById() method
      7. 8.7. Exercises
    6. 9. Forms and Form Elements
      1. 9.1. The form Object
        1. 9.1.1. Form as object and container
        2. 9.1.2. Accessing form properties
        3. 9.1.3. form.elements[] property
      2. 9.2. Form Controls as Objects
        1. 9.2.1. Text-related input objects
        2. 9.2.2. The button input object
        3. 9.2.3. The checkbox input object
        4. 9.2.4. The radio input object
        5. 9.2.5. The select object
      3. 9.3. Passing Form Data and Elements to Functions
      4. 9.4. Submitting and Prevalidating Forms
      5. 9.5. Exercises
    7. 10. Strings, Math, and Dates
      1. 10.1. Core Language Objects
      2. 10.2. String Objects
        1. 10.2.1. Joining strings
        2. 10.2.2. String methods
          1. 10.2.2.1. Changing string case
          2. 10.2.2.2. String searches
          3. 10.2.2.3. Extracting copies of characters and substrings
      3. 10.3. The Math Object
      4. 10.4. The Date Object
      5. 10.5. Date Calculations
      6. 10.6. Exercises
    8. 11. Scripting Frames and Multiple Windows
      1. 11.1. Frames: Parents and Children
      2. 11.2. References Among Family Members
        1. 11.2.1. Parent-to-child references
        2. 11.2.2. Child-to-parent references
        3. 11.2.3. Child-to-child references
      3. 11.3. Frame-Scripting Tips
      4. 11.4. About iframe Elements
      5. 11.5. Controlling Multiple Frames: Navigation Bars
      6. 11.6. References for Multiple Windows
      7. 11.7. Exercises
    9. 12. Images and Dynamic HTML
      1. 12.1. The Image Object
        1. 12.1.1. Interchangeable images
        2. 12.1.2. Precaching images
        3. 12.1.3. Creating image rollovers
      2. 12.2. Rollovers Without Scripts
      3. 12.3. The javascript: Pseudo-URL
      4. 12.4. Popular Dynamic HTML Techniques
        1. 12.4.1. Changing stylesheet settings
        2. 12.4.2. Dynamic content via W3C DOM nodes
        3. 12.4.3. Dynamic content through the innerHTML property
      5. 12.5. Exercises
  9. III. Document Objects Reference
    1. 13. JavaScript Essentials
      1. 13.1. JavaScript Versions
      2. 13.2. Core Language Standard: ECMAScript
      3. 13.3. Embedding Scripts in HTML Documents
        1. 13.3.1. <script> tags
          1. 13.3.1.1. Specifying the language version
          2. 13.3.1.2. <script for> tags
        2. 13.3.2. Hiding script statements from older browsers
        3. 13.3.3. Hiding scripts entirely?
        4. 13.3.4. Hiding scripts from XHTML validators
        5. 13.3.5. Script libraries (.js files)
      4. 13.4. Browser Version Detection
        1. 13.4.1. Coding for nonscriptable browsers
        2. 13.4.2. Scripting for different browsers
          1. 13.4.2.1. Establishing goals
          2. 13.4.2.2. Object detection
          3. 13.4.2.3. Modifying content for scriptable browsers
      5. 13.5. Designing for Compatibility
        1. 13.5.1. Dealing with beta browsers
        2. 13.5.2. The Evaluator Sr.
        3. 13.5.3. Compatibility ratings in reference chapters
      6. 13.6. Language Essentials for Experienced Programmers
      7. 13.7. Onward to Object Models
    2. 14. Document Object Model Essentials
      1. 14.1. The Object Model Hierarchy
        1. 14.1.1. Hierarchy as road map
        2. 14.1.2. The first browser document object road map
      2. 14.2. How Document Objects Are Born
      3. 14.3. Object Properties
      4. 14.4. Object Methods
      5. 14.5. Object Event Handlers
      6. 14.6. Object Model Smorgasbord
      7. 14.7. Basic Object Model
      8. 14.8. Basic Object Model Plus Images
      9. 14.9. Navigator 4–Only Extensions
        1. 14.9.1. Event capture model
        2. 14.9.2. Layers
      10. 14.10. Internet Explorer 4+ Extensions
        1. 14.10.1. HTML element objects
        2. 14.10.2. Element containment hierarchy
        3. 14.10.3. Cascading Style Sheets
        4. 14.10.4. Event bubbling
      11. 14.11. Internet Explorer 5+ Extensions
      12. 14.12. The W3C DOM
        1. 14.12.1. DOM levels
        2. 14.12.2. What stays the same
        3. 14.12.3. What isn't available
        4. 14.12.4. New HTML practices
        5. 14.12.5. New DOM concepts
          1. 14.12.5.1. Element referencing
          2. 14.12.5.2. A hierarchy of nodes
          3. 14.12.5.3. Node properties
          4. 14.12.5.4. Node methods
          5. 14.12.5.5. Generating new node content
          6. 14.12.5.6. Replacing node content
          7. 14.12.5.7. A de facto standard: innerHTML
        6. 14.12.6. Static W3C DOM HTML objects
        7. 14.12.7. Bidirectional event model
      13. 14.13. Scripting Trends
        1. 14.13.1. Separating content from scripting
        2. 14.13.2. Using the W3C DOM where possible
        3. 14.13.3. Handling events
      14. 14.14. Standards Compatibility Modes (DOCTYPE Switching)
      15. 14.15. Where to Go from Here
    3. 15. Generic HTML Element Objects
      1. 15.1. Generic Objects
        1. 15.1.1. Syntax
        2. 15.1.2. About these objects
        3. 15.1.3. Properties
          1. 15.1.3.1. Example
          2. 15.1.3.2. Example
          3. 15.1.3.3. Example
          4. 15.1.3.4. Example
          5. 15.1.3.5. Example
          6. 15.1.3.6. Example
          7. 15.1.3.7. Example
          8. 15.1.3.8. Example
          9. 15.1.3.9. Example
          10. 15.1.3.10. Example
          11. 15.1.3.11. Example
          12. 15.1.3.12. Example
          13. 15.1.3.13. Example
          14. 15.1.3.14. Example
          15. 15.1.3.15. Example
          16. 15.1.3.16. Example
          17. 15.1.3.17. Example
          18. 15.1.3.18. Example
          19. 15.1.3.19. Example
          20. 15.1.3.20. Example
          21. 15.1.3.21. Example
          22. 15.1.3.22. Example
          23. 15.1.3.23. Example
          24. 15.1.3.24. Example
          25. 15.1.3.25. Example
          26. 15.1.3.26. Example
          27. 15.1.3.27. Example
          28. 15.1.3.28. Example
          29. 15.1.3.29. Example
          30. 15.1.3.30. Example
          31. 15.1.3.31. Example
          32. 15.1.3.32. Example
          33. 15.1.3.33. Example
          34. 15.1.3.34. Example
          35. 15.1.3.35. Example
          36. 15.1.3.36. Example
          37. 15.1.3.37. Example
          38. 15.1.3.38. Example
          39. 15.1.3.39. Example
          40. 15.1.3.40. Example
          41. 15.1.3.41. Example
          42. 15.1.3.42. Example
          43. 15.1.3.43. Example
          44. 15.1.3.44. Example
          45. 15.1.3.45. Example
          46. 15.1.3.46. Example
          47. 15.1.3.47. Example
          48. 15.1.3.48. Example
          49. 15.1.3.49. Example
          50. 15.1.3.50. Example
        4. 15.1.4. Methods
          1. 15.1.4.1. Example
          2. 15.1.4.2. Example
          3. 15.1.4.3. Example
          4. 15.1.4.4. Example
          5. 15.1.4.5. Example
          6. 15.1.4.6. Windows
          7. 15.1.4.7. Form control elements
          8. 15.1.4.8. Other elements
          9. 15.1.4.9. Example
          10. 15.1.4.10. Example
          11. 15.1.4.11. Example
          12. 15.1.4.12. Example
          13. 15.1.4.13. Example
          14. 15.1.4.14. Example
          15. 15.1.4.15. Example
          16. 15.1.4.16. Example
          17. 15.1.4.17. Example
          18. 15.1.4.18. Example
          19. 15.1.4.19. Example
          20. 15.1.4.20. Example
          21. 15.1.4.21. Example
          22. 15.1.4.22. Example
          23. 15.1.4.23. Example
          24. 15.1.4.24. Example
          25. 15.1.4.25. Example
          26. 15.1.4.26. Example
          27. 15.1.4.27. Example
          28. 15.1.4.28. Example
          29. 15.1.4.29. Example
          30. 15.1.4.30. Example
          31. 15.1.4.31. Example
          32. 15.1.4.32. Example
          33. 15.1.4.33. Example
          34. 15.1.4.34. Example
          35. 15.1.4.35. Example
          36. 15.1.4.36. Example
          37. 15.1.4.37. Example
          38. 15.1.4.38. Example
          39. 15.1.4.39. Example
          40. 15.1.4.40. Example
          41. 15.1.4.41. Example
          42. 15.1.4.42. Example
          43. 15.1.4.43. Example
          44. 15.1.4.44. Example
          45. 15.1.4.45. Example
          46. 15.1.4.46. Example
          47. 15.1.4.47. Example
          48. 15.1.4.48. Example
        5. 15.1.5. Event handlers
          1. 15.1.5.1. Example
          2. 15.1.5.2. Example
          3. 15.1.5.3. Example
          4. 15.1.5.4. Example
          5. 15.1.5.5. Example
          6. 15.1.5.6. Example
          7. 15.1.5.7. Example
          8. 15.1.5.8. Example
          9. 15.1.5.9. Example
          10. 15.1.5.10. Example
          11. 15.1.5.11. Example
          12. 15.1.5.12. Example
          13. 15.1.5.13. Example
          14. 15.1.5.14. Example
          15. 15.1.5.15. Example
          16. 15.1.5.16. Example
        6. 15.1.6. Common keyboard event tasks
          1. 15.1.6.1. Example
          2. 15.1.6.2. Example
          3. 15.1.6.3. Example
          4. 15.1.6.4. Example
          5. 15.1.6.5. Example
          6. 15.1.6.6. Example
          7. 15.1.6.7. Example
          8. 15.1.6.8. Example
          9. 15.1.6.9. Example
          10. 15.1.6.10. Example
    4. 16. Window and Frame Objects
      1. 16.1. Window Terminology
      2. 16.2. Frames
        1. 16.2.1. Creating frames
        2. 16.2.2. The frame object model
        3. 16.2.3. Referencing frames
        4. 16.2.4. Top versus parent
        5. 16.2.5. Preventing framing
        6. 16.2.6. Ensuring framing
        7. 16.2.7. Switching from frames to frameless
        8. 16.2.8. Inheritance versus containment
        9. 16.2.9. Frame synchronization
        10. 16.2.10. Blank frames
        11. 16.2.11. Viewing frame source code
        12. 16.2.12. Frames versus frame element objects
      3. 16.3. window 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
          3. 16.3.3.3. Example
          4. 16.3.3.4. Example
          5. 16.3.3.5. Example
          6. 16.3.3.6. Example
          7. 16.3.3.7. Example
          8. 16.3.3.8. Example
          9. 16.3.3.9. Example
          10. 16.3.3.10. Example
          11. 16.3.3.11. Example
          12. 16.3.3.12. Example
          13. 16.3.3.13. Example
          14. 16.3.3.14. Example
          15. 16.3.3.15. Example
          16. 16.3.3.16. Example
          17. 16.3.3.17. Example
          18. 16.3.3.18. Example
          19. 16.3.3.19. Example
          20. 16.3.3.20. Example
          21. 16.3.3.21. Example
          22. 16.3.3.22. Example
          23. 16.3.3.23. Example
        4. 16.3.4. Methods
          1. 16.3.4.1. Example
          2. 16.3.4.2. Example
          3. 16.3.4.3. Example
          4. 16.3.4.4. Example
          5. 16.3.4.5. Example
          6. 16.3.4.6. Example
          7. 16.3.4.7. Example
          8. 16.3.4.8. Example
          9. 16.3.4.9. Example
          10. 16.3.4.10. Example
          11. 16.3.4.11. Setting new window features
          12. 16.3.4.12. Netscape/Mozilla-only signed scripts
          13. 16.3.4.13. Specifying a window name
          14. 16.3.4.14. Loading content into a new window
          15. 16.3.4.15. Internet Explorer idiosyncrasies
          16. 16.3.4.16. Example
          17. 16.3.4.17. Example
          18. 16.3.4.18. Example
          19. 16.3.4.19. Example
          20. 16.3.4.20. Example
          21. 16.3.4.21. Passing function parameters
          22. 16.3.4.22. Example
          23. 16.3.4.23. Example
          24. 16.3.4.24. Retrieving dialog-box data
          25. 16.3.4.25. Dialog-box window features
          26. 16.3.4.26. Dialog-box cautions
          27. 16.3.4.27. Example
          28. 16.3.4.28. Example
        5. 16.3.5. Event handlers
          1. 16.3.5.1. Example
          2. 16.3.5.2. Example
          3. 16.3.5.3. Example
          4. 16.3.5.4. Example
      4. 16.4. frame Element Object
        1. 16.4.1. Syntax
        2. 16.4.2. About this object
        3. 16.4.3. Properties
          1. 16.4.3.1. Example
          2. 16.4.3.2. Example
          3. 16.4.3.3. Example
          4. 16.4.3.4. Example
          5. 16.4.3.5. Example
          6. 16.4.3.6. Example
          7. 16.4.3.7. Example
          8. 16.4.3.8. Example
      5. 16.5. frameset Element Object
        1. 16.5.1. Syntax
        2. 16.5.2. About this object
        3. 16.5.3. Properties
          1. 16.5.3.1. Example
          2. 16.5.3.2. Example
          3. 16.5.3.3. Example
          4. 16.5.3.4. Example
          5. 16.5.3.5. Example
      6. 16.6. iframe Element Object
        1. 16.6.1. Syntax
        2. 16.6.2. About this object
        3. 16.6.3. Properties
          1. 16.6.3.1. Example
          2. 16.6.3.2. Example
          3. 16.6.3.3. Example
          4. 16.6.3.4. Example
      7. 16.7. popup Object
        1. 16.7.1. Syntax
        2. 16.7.2. About this object
        3. 16.7.3. Properties
          1. 16.7.3.1. Example
          2. 16.7.3.2. Example
        4. 16.7.4. Methods
          1. 16.7.4.1. Example
    5. 17. Location and History Objects
      1. 17.1. location Object
        1. 17.1.1. Syntax
        2. 17.1.2. About this object
        3. 17.1.3. Properties
          1. 17.1.3.1. Passing data among pages via URLs
        4. 17.1.4. Methods
      2. 17.2. history Object
        1. 17.2.1. Syntax
        2. 17.2.2. About this object
        3. 17.2.3. Properties
        4. 17.2.4. Methods
    6. 18. The Document and Body Objects
      1. 18.1. document Object
        1. 18.1.1. Syntax
        2. 18.1.2. About this object
        3. 18.1.3. Properties
          1. 18.1.3.1. Example
          2. 18.1.3.2. Example
          3. 18.1.3.3. Example
          4. 18.1.3.4. Example
          5. 18.1.3.5. Example
          6. 18.1.3.6. Example
          7. 18.1.3.7. Example
          8. 18.1.3.8. Example
          9. 18.1.3.9. The cookie file
          10. 18.1.3.10. A cookie record
          11. 18.1.3.11. JavaScript access
          12. 18.1.3.12. Saving cookies
          13. 18.1.3.13. Name/Data
          14. 18.1.3.14. Expires
          15. 18.1.3.15. Path
          16. 18.1.3.16. Domain
          17. 18.1.3.17. SECURE
          18. 18.1.3.18. Retrieving cookie data
          19. 18.1.3.19. Extra batches
          20. 18.1.3.20. Example
          21. 18.1.3.21. Example
          22. 18.1.3.22. Example
          23. 18.1.3.23. Example
          24. 18.1.3.24. Example
          25. 18.1.3.25. Example
          26. 18.1.3.26. Example
          27. 18.1.3.27. Example
          28. 18.1.3.28. Example
          29. 18.1.3.29. Example
          30. 18.1.3.30. Example
          31. 18.1.3.31. Example
          32. 18.1.3.32. Example
          33. 18.1.3.33. Example
          34. 18.1.3.34. Example
          35. 18.1.3.35. Example
          36. 18.1.3.36. Example
          37. 18.1.3.37. Example
          38. 18.1.3.38. Example
        4. 18.1.4. Methods
          1. 18.1.4.1. Example
          2. 18.1.4.2. Example
          3. 18.1.4.3. Example
          4. 18.1.4.4. Example
          5. 18.1.4.5. Example
          6. 18.1.4.6. Example
          7. 18.1.4.7. Example
          8. 18.1.4.8. Example
          9. 18.1.4.9. Example
          10. 18.1.4.10. Example
          11. 18.1.4.11. Example
          12. 18.1.4.12. Example
          13. 18.1.4.13. Example
          14. 18.1.4.14. Example
          15. 18.1.4.15. Example
        5. 18.1.5. Event handlers
          1. 18.1.5.1. Example
      2. 18.2. body Element Object
        1. 18.2.1. Syntax
        2. 18.2.2. About this object
        3. 18.2.3. Properties
          1. 18.2.3.1. Example
          2. 18.2.3.2. Example
          3. 18.2.3.3. Example
          4. 18.2.3.4. Example
          5. 18.2.3.5. Example
        4. 18.2.4. Methods
          1. 18.2.4.1. Example
          2. 18.2.4.2. Example
        5. 18.2.5. Event handlers
      3. 18.3. TreeWalker Object
        1. 18.3.1. Syntax
        2. 18.3.2. About this object
        3. 18.3.3. Properties
          1. 18.3.3.1. Example
        4. 18.3.4. Methods
          1. 18.3.4.1. Example
          2. 18.3.4.2. Example
    7. 19. Link and Anchor Objects
      1. 19.1. Anchor, Link, and a Element Objects
        1. 19.1.1. Syntax
        2. 19.1.2. About this object
        3. 19.1.3. Properties
    8. 20. Image, Area, Map, and Canvas Objects
      1. 20.1. Image and img Element Objects
        1. 20.1.1. Syntax
        2. 20.1.2. About this object
        3. 20.1.3. Properties
          1. 20.1.3.1. Example
          2. 20.1.3.2. Example
          3. 20.1.3.3. Example
          4. 20.1.3.4. Example
          5. 20.1.3.5. Example
          6. 20.1.3.6. Example
          7. 20.1.3.7. Example
          8. 20.1.3.8. Example
          9. 20.1.3.9. Example
          10. 20.1.3.10. Example
          11. 20.1.3.11. Example
          12. 20.1.3.12. Example
          13. 20.1.3.13. Example
        4. 20.1.4. Event handlers
          1. 20.1.4.1. Example
      2. 20.2. area Element Object
        1. 20.2.1. Syntax
        2. 20.2.2. About this object
        3. 20.2.3. Properties
      3. 20.3. map Element Object
        1. 20.3.1. Syntax
        2. 20.3.2. About this object
        3. 20.3.3. Properties
      4. 20.4. canvas Element Object
        1. 20.4.1. Syntax
        2. 20.4.2. About this object
        3. 20.4.3. Properties
          1. 20.4.3.1. Example
          2. 20.4.3.2. Example
          3. 20.4.3.3. Example
          4. 20.4.3.4. Example
          5. 20.4.3.5. Example
          6. 20.4.3.6. Example
        4. 20.4.4. Methods
    9. 21. The Form and Related Objects
      1. 21.1. The Form in the Object Hierarchy
      2. 21.2. form Object
        1. 21.2.1. Syntax
        2. 21.2.2. About this object
        3. 21.2.3. References to form control elements
        4. 21.2.4. Passing forms and elements to functions
        5. 21.2.5. E-mailing forms
        6. 21.2.6. Changing form attributes
        7. 21.2.7. Buttons in forms
        8. 21.2.8. Redirection after submission
        9. 21.2.9. Form element arrays
        10. 21.2.10. About <input> element objects
        11. 21.2.11. Properties
        12. 21.2.12. Methods
        13. 21.2.13. Event handlers
      3. 21.3. fieldset and legend Element Objects
        1. 21.3.1. Syntax
        2. 21.3.2. About these objects
      4. 21.4. label Element Object
        1. 21.4.1. Syntax
        2. 21.4.2. About this object
        3. 21.4.3. Properties
      5. 21.5. Scripting and Web Forms 2.0
        1. 21.5.1. What is Web Forms 2.0?
        2. 21.5.2. Web Forms 2.0 and JavaScript
    10. 22. Button Objects
      1. 22.1. The button Element Object, and the Button, Submit, and Reset Input Objects
        1. 22.1.1. Syntax
        2. 22.1.2. About these objects
        3. 22.1.3. Properties
        4. 22.1.4. Methods
        5. 22.1.5. Event handlers
      2. 22.2. checkbox Input Object
        1. 22.2.1. Syntax
        2. 22.2.2. About this object
        3. 22.2.3. Properties
        4. 22.2.4. Methods
        5. 22.2.5. Event handlers
      3. 22.3. radio Input Object
        1. 22.3.1. Syntax
        2. 22.3.2. About this object
        3. 22.3.3. Properties
        4. 22.3.4. Methods
        5. 22.3.5. Event handlers
      4. 22.4. image Input Object
        1. 22.4.1. Syntax
        2. 22.4.2. About this object
        3. 22.4.3. Properties
    11. 23. Text-Related Form Objects
      1. 23.1. Text Input Object
        1. 23.1.1. Syntax
        2. 23.1.2. About this object
        3. 23.1.3. Text fields and events
        4. 23.1.4. Properties
        5. 23.1.5. Methods
        6. 23.1.6. Event handlers
      2. 23.2. password Input Object
        1. 23.2.1. Syntax
        2. 23.2.2. About this object
      3. 23.3. hidden Input Object
        1. 23.3.1. Syntax
        2. 23.3.2. About this object
      4. 23.4. textarea Element Object
        1. 23.4.1. Syntax
        2. 23.4.2. About this object
        3. 23.4.3. Carriage returns inside textareas
        4. 23.4.4. Properties
        5. 23.4.5. Methods
    12. 24. Select, Option, and FileUpload Objects
      1. 24.1. select Element Object
        1. 24.1.1. Syntax
        2. 24.1.2. About this object
        3. 24.1.3. Modifying select options (NN3+, IE4+)
        4. 24.1.4. Modifying select options (IE4+)
        5. 24.1.5. Modifying select options (W3C DOM)
        6. 24.1.6. Properties
        7. 24.1.7. Methods
        8. 24.1.8. Event handlers
      2. 24.2. option Element Object
        1. 24.2.1. Syntax
        2. 24.2.2. About this object
        3. 24.2.3. Properties
      3. 24.3. optgroup Element Object
        1. 24.3.1. Syntax
        2. 24.3.2. About this object
        3. 24.3.3. Properties
      4. 24.4. file Input Element Object
        1. 24.4.1. Syntax
        2. 24.4.2. About this object
    13. 25. Event Objects
      1. 25.1. Why "Events"?
        1. 25.1.1. What an event knows (and when it knows it)
        2. 25.1.2. The static Event object
      2. 25.2. Event Propagation
        1. 25.2.1. NN4-only event propagation
          1. 25.2.1.1. Enabling NN4 event capture
          2. 25.2.1.2. Turning off event capture
          3. 25.2.1.3. Passing events toward their targets
          4. 25.2.1.4. Event traffic cop
        2. 25.2.2. IE4+ event propagation
          1. 25.2.2.1. Preventing IE event bubbling
          2. 25.2.2.2. Preventing IE event default action
          3. 25.2.2.3. Redirecting events
          4. 25.2.2.4. Applying event capture
        3. 25.2.3. W3C event propagation
          1. 25.2.3.1. Preventing W3C event bubbling or capture
          2. 25.2.3.2. Preventing W3C event default action
          3. 25.2.3.3. Redirecting W3C DOM events
      3. 25.3. Referencing the event object
      4. 25.4. Binding Events
        1. 25.4.1. Binding events through tag attributes
        2. 25.4.2. Binding events through object properties
        3. 25.4.3. Binding events through IE attachments
        4. 25.4.4. Binding events through W3C listeners
        5. 25.4.5. A cross-browser event binding solution
      5. 25.5. event Object Compatibility
      6. 25.6. Dueling Event Models
        1. 25.6.1. Cross-platform modifier key check
        2. 25.6.2. Cross-platform key capture
      7. 25.7. Event Types
        1. 25.7.1. Event types in IE4+ and NN6+/W3C
      8. 25.8. IE4+ event Object
        1. 25.8.1. Syntax
        2. 25.8.2. About this object
        3. 25.8.3. Properties
          1. 25.8.3.1. Example
          2. 25.8.3.2. Example
          3. 25.8.3.3. Example
          4. 25.8.3.4. Example
          5. 25.8.3.5. Example
          6. 25.8.3.6. Example
          7. 25.8.3.7. Example
          8. 25.8.3.8. Example
          9. 25.8.3.9. Example
          10. 25.8.3.10. Example
          11. 25.8.3.11. Example
      9. 25.9. NN6+/Moz/Safari event Object
        1. 25.9.1. Syntax
        2. 25.9.2. About this object
        3. 25.9.3. Properties
          1. 25.9.3.1. Example
          2. 25.9.3.2. Example
          3. 25.9.3.3. Example
          4. 25.9.3.4. Example
          5. 25.9.3.5. Example
          6. 25.9.3.6. Example
          7. 25.9.3.7. Example
          8. 25.9.3.8. Example
          9. 25.9.3.9. Example
          10. 25.9.3.10. Example
        4. 25.9.4. Methods
    14. 26. Style Sheet and Style Objects
      1. 26.1. Making Sense of the Object Names
      2. 26.2. Imported Stylesheets
      3. 26.3. Reading Style Properties
      4. 26.4. style Element Object
        1. 26.4.1. Syntax
        2. 26.4.2. About this object
        3. 26.4.3. Properties
      5. 26.5. styleSheet Object
        1. 26.5.1. Syntax
        2. 26.5.2. About this object
        3. 26.5.3. Properties
          1. 26.5.3.1. Example
          2. 26.5.3.2. Example
          3. 26.5.3.3. Example
          4. 26.5.3.4. Example
          5. 26.5.3.5. Example
          6. 26.5.3.6. Example
        4. 26.5.4. Methods
          1. 26.5.4.1. Example
          2. 26.5.4.2. Example
      6. 26.6. cssRule and rule Objects
        1. 26.6.1. Syntax
        2. 26.6.2. About these objects
        3. 26.6.3. Properties
          1. 26.6.3.1. Example
          2. 26.6.3.2. Example
      7. 26.7. currentStyle, runtimeStyle, and style Objects
        1. 26.7.1. Syntax
        2. 26.7.2. About these objects
        3. 26.7.3. Style properties
        4. 26.7.4. Property values
          1. 26.7.4.1. Length
          2. 26.7.4.2. Color
          3. 26.7.4.3. Rectangle sides
          4. 26.7.4.4. Combination values
          5. 26.7.4.5. URLs
        5. 26.7.5. Text and font properties
        6. 26.7.6. Inline display and layout properties
        7. 26.7.7. Positioning properties
        8. 26.7.8. Background properties
        9. 26.7.9. Border and edge properties
        10. 26.7.10. List properties
        11. 26.7.11. Scroll bar properties
        12. 26.7.12. Table properties
        13. 26.7.13. Page and printing properties
        14. 26.7.14. Miscellaneous properties
        15. 26.7.15. Aural properties
      8. 26.8. filter Object
        1. 26.8.1. Syntax
        2. 26.8.2. About this object
          1. 26.8.2.1. Reading and writing subproperties
        3. 26.8.3. WinIE5.5+ filter syntax changes
    15. 27. Ajax and XML
      1. 27.1. Elements and Nodes
      2. 27.2. xml Element Object
        1. 27.2.1. Syntax
        2. 27.2.2. About this object
        3. 27.2.3. Properties
      3. 27.3. XMLHttpRequest Object
        1. 27.3.1. Syntax
        2. 27.3.2. About this object
        3. 27.3.3. Properties
        4. 27.3.4. Methods
  10. IV. JavaScript Core Language Reference
    1. 28. The String Object
      1. 28.1. String and Number Data Types
        1. 28.1.1. Simple strings
        2. 28.1.2. Building long string variables
        3. 28.1.3. Joining string literals and variables
        4. 28.1.4. Special inline characters
      2. 28.2. String Object
        1. 28.2.1. Syntax
        2. 28.2.2. About this object
        3. 28.2.3. Properties
          1. 28.2.3.1. Example
        4. 28.2.4. Parsing methods
          1. 28.2.4.1. Example
          2. 28.2.4.2. Example
          3. 28.2.4.3. Example
          4. 28.2.4.4. Example
          5. 28.2.4.5. Example
          6. 28.2.4.6. Example
          7. 28.2.4.7. Example
          8. 28.2.4.8. Example
          9. 28.2.4.9. Example
          10. 28.2.4.10. Example
          11. 28.2.4.11. Example
          12. 28.2.4.12. Example
          13. 28.2.4.13. Example
      3. 28.3. String Utility Functions
        1. 28.3.1. Formatting methods
      4. 28.4. URL String Encoding and Decoding
    2. 29. The Math, Number, and Boolean Objects
      1. 29.1. Numbers in JavaScript
        1. 29.1.1. Integers and floating-point numbers
        2. 29.1.2. Hexadecimal and octal integers
        3. 29.1.3. Converting strings to numbers
        4. 29.1.4. Converting numbers to strings
        5. 29.1.5. When a number isn't a number
      2. 29.2. Math Object
        1. 29.2.1. Syntax
        2. 29.2.2. About this object
        3. 29.2.3. Properties
        4. 29.2.4. Methods
        5. 29.2.5. Creating random numbers
        6. 29.2.6. Math object shortcut
      3. 29.3. Number Object
        1. 29.3.1. Syntax
        2. 29.3.2. About this object
        3. 29.3.3. Properties
          1. 29.3.3.1. Example
          2. 29.3.3.2. Example
        4. 29.3.4. Methods
          1. 29.3.4.1. Example
          2. 29.3.4.2. Example
      4. 29.4. Boolean Object
        1. 29.4.1. Syntax
        2. 29.4.2. About this object
    3. 30. The Date Object
      1. 30.1. Time Zones and GMT
      2. 30.2. The Date Object
        1. 30.2.1. Creating a date object
        2. 30.2.2. Native object properties and methods
        3. 30.2.3. Date methods
        4. 30.2.4. Accommodating time zones
        5. 30.2.5. Dates as strings
        6. 30.2.6. Friendly date formats for older browsers
        7. 30.2.7. More conversions
        8. 30.2.8. Date and time arithmetic
        9. 30.2.9. Counting the days . . .
        10. 30.2.10. Early browser date bugs and gremlins
      3. 30.3. Validating Date Entries in Forms
    4. 31. The Array Object
      1. 31.1. Structured Data
      2. 31.2. Creating an Empty Array
      3. 31.3. Populating an Array
      4. 31.4. JavaScript Array Creation Enhancements
      5. 31.5. Deleting Array Entries
      6. 31.6. Parallel Arrays
      7. 31.7. Multidimensional Arrays
      8. 31.8. Simulating a Hash Table
      9. 31.9. Array Object Properties
        1. 31.9.1.
          1. 31.9.1.1. Example
      10. 31.10. Array Object Methods
        1. 31.10.1.
          1. 31.10.1.1. Example
          2. 31.10.1.2. Example
          3. 31.10.1.3. Example
          4. 31.10.1.4. Example
          5. 31.10.1.5. Example
    5. 32. Control Structures and Exception Handling
      1. 32.1. If and If. . .Else Decisions
        1. 32.1.1. Simple decisions
        2. 32.1.2. About (condition) expressions
        3. 32.1.3. Complex decisions
        4. 32.1.4. Nesting if. . .else statements
      2. 32.2. Conditional Expressions
      3. 32.3. Repeat (for) Loops
        1. 32.3.1. Putting the loop counter to work
        2. 32.3.2. Breaking out of a loop
        3. 32.3.3. Directing loop traffic with continue
      4. 32.4. The while Loop
      5. 32.5. The do-while Loop
      6. 32.6. Looping through Properties (for-in)
      7. 32.7. The with Statement
      8. 32.8. Labeled Statements
      9. 32.9. The switch Statement
      10. 32.10. Exception Handling
        1. 32.10.1. Exceptions and errors
        2. 32.10.2. The exception mechanism
      11. 32.11. Using try-catch-finally Constructions
        1. 32.11.1. Real-life exceptions
      12. 32.12. Throwing Exceptions
      13. 32.13. Error Object
        1. 32.13.1. Syntax
        2. 32.13.2. About this object
        3. 32.13.3. Properties
        4. 32.13.4. Methods
    6. 33. JavaScript Operators
      1. 33.1. Operator Categories
      2. 33.2. Comparison Operators
      3. 33.3. Equality of Disparate Data Types
      4. 33.4. Connubial Operators
      5. 33.5. Assignment Operators
      6. 33.6. Boolean Operators
        1. 33.6.1. Boolean math
        2. 33.6.2. Boolean operators at work
      7. 33.7. Bitwise Operators
        1. 33.7.1.
          1. 33.7.1.1. Example
      8. 33.8. Object Operators
        1. 33.8.1.
          1. 33.8.1.1. Example
          2. 33.8.1.2. Example
          3. 33.8.1.3. Example
          4. 33.8.1.4. new
          5. 33.8.1.5. this
          6. 33.8.1.6. Example
      9. 33.9. Miscellaneous Operators
        1. 33.9.1.
          1. 33.9.1.1. Example
          2. 33.9.1.2. Example
      10. 33.10. Operator Precedence
    7. 34. Functions and Custom Objects
      1. 34.1. Function Object
        1. 34.1.1. Syntax
        2. 34.1.2. About this object
        3. 34.1.3. Creating functions
        4. 34.1.4. Nesting functions
        5. 34.1.5. Function parameters
        6. 34.1.6. Properties
          1. 34.1.6.1. Example
          2. 34.1.6.2. Example
        7. 34.1.7. Methods
          1. 34.1.7.1. Example
      2. 34.2. Function Application Notes
        1. 34.2.1. Invoking functions
        2. 34.2.2. Variable scope: Globals and locals
        3. 34.2.3. Parameter variables
        4. 34.2.4. Recursion in functions
        5. 34.2.5. Turning functions into libraries
        6. 34.2.6. Making sense of closures
      3. 34.3. Creating Your Own Objects with Object-Oriented JavaScript
        1. 34.3.1. The nuts and bolts of objects
          1. 34.3.1.1. Creating properties for custom objects
          2. 34.3.1.2. Creating methods for custom objects
        2. 34.3.2. An OOP example—planetary objects
        3. 34.3.3. Further encapsulation
        4. 34.3.4. Creating an array of objects
        5. 34.3.5. Taking advantage of embedded objects
        6. 34.3.6. The modern way to create objects
        7. 34.3.7. Defining object property getters and setters
      4. 34.4. Object-Oriented Concepts
        1. 34.4.1. Adding a prototype
        2. 34.4.2. Prototype inheritance
        3. 34.4.3. Nested objects and prototype inheritance
      5. 34.5. Object Object
        1. 34.5.1. Syntax
        2. 34.5.2. About this object
        3. 34.5.3. Methods
    8. 35. Global Functions and Statements
      1. 35.1. Functions
        1. 35.1.1.
          1. 35.1.1.1. Example
          2. 35.1.1.2. Example
          3. 35.1.1.3. Example
          4. 35.1.1.4. Example
          5. 35.1.1.5. Example
      2. 35.2. Statements
        1. 35.2.1.
          1. 35.2.1.1. Example
  11. V. Appendixes
    1. A. JavaScript and Browser Objects Quick Reference
    2. B. JavaScript Reserved Words
    3. C. Answers to Tutorial Exercises
      1. C.1. Chapter 4 Answers
      2. C.2. Chapter 5 Answers
      3. C.3. Chapter 6 Answers
      4. C.4. Chapter 7 Answers
      5. C.5. Chapter 8 Answers
      6. C.6. Chapter 9 Answers
      7. C.7. Chapter 10 Answers
      8. C.8. Chapter 11 Answers
      9. C.9. Chapter 12 Answers
    4. D. JavaScript and DOM Internet Resources
      1. D.1. Support and Updates for This Book
      2. D.2. Newsgroups
      3. D.3. FAQs
      4. D.4. Online Documentation
      5. D.5. World Wide Web
    5. E. What's on the CD-ROM
      1. E.1. System Requirements
      2. E.2. Disc Contents
        1. E.2.1. JavaScript listings for text editors
        2. E.2.2. Printable version of the JavaScript and Browser Object Quick Reference from Appendix A
        3. E.2.3. Adobe Reader
          1. E.2.3.1. For Windows
          2. E.2.3.2. For Macintosh
        4. E.2.4. PDF version of book with topical references
      3. E.3. Troubleshooting
      4. E.4. Customer Care
  12. VI. Bonus Chapters
    1. 36. Body Text Objects
      1. 36.1. blockquote and q Element Objects
        1. 36.1.1. Syntax
        2. 36.1.2. About these objects
        3. 36.1.3. Property
      2. 36.2. br Element Object
        1. 36.2.1. Syntax
        2. 36.2.2. About this object
        3. 36.2.3. Property
      3. 36.3. font Element Object
        1. 36.3.1. Syntax
        2. 36.3.2. About this object
        3. 36.3.3. Properties
          1. 36.3.3.1. Example
          2. 36.3.3.2. Example
          3. 36.3.3.3. Example
      4. 36.4. h1...h6 Element Objects
        1. 36.4.1. Syntax
        2. 36.4.2. About these objects
        3. 36.4.3. Property
      5. 36.5. hr Element Object
        1. 36.5.1. Syntax
        2. 36.5.2. About this object
        3. 36.5.3. Properties
          1. 36.5.3.1. Example
          2. 36.5.3.2. Example
          3. 36.5.3.3. Example
          4. 36.5.3.4. Example
          5. 36.5.3.5. Example
      6. 36.6. label Element Object
        1. 36.6.1. Syntax
        2. 36.6.2. About this object
        3. 36.6.3. Properties
          1. 36.6.3.1. Example
      7. 36.7. marquee Element Object
        1. 36.7.1. Syntax
        2. 36.7.2. About this object
        3. 36.7.3. Properties
          1. 36.7.3.1. Example
          2. 36.7.3.2. Example
          3. 36.7.3.3. Example
          4. 36.7.3.4. Example
        4. 36.7.4. Methods
          1. 36.7.4.1. Example
      8. 36.8. Event Handlers
      9. 36.9. Range Object
        1. 36.9.1. Syntax
        2. 36.9.2. About this object
        3. 36.9.3. Working with ranges
        4. 36.9.4. Properties
          1. 36.9.4.1. Example
          2. 36.9.4.2. Example
          3. 36.9.4.3. Example
          4. 36.9.4.4. Example
        5. 36.9.5. Methods
          1. 36.9.5.1. Example
          2. 36.9.5.2. Example
          3. 36.9.5.3. Example
          4. 36.9.5.4. Example
          5. 36.9.5.5. Example
          6. 36.9.5.6. Example
          7. 36.9.5.7. Example
          8. 36.9.5.8. Example
          9. 36.9.5.9. Example
          10. 36.9.5.10. Example
          11. 36.9.5.11. Example
      10. 36.10. selection Object
        1. 36.10.1. Syntax
        2. 36.10.2. About this object
        3. 36.10.3. Properties
          1. 36.10.3.1. Example
        4. 36.10.4. Methods
          1. 36.10.4.1. Example
          2. 36.10.4.2. Example
          3. 36.10.4.3. Example
      11. 36.11. Text and TextNode Objects
        1. 36.11.1. Syntax
        2. 36.11.2. About this object
        3. 36.11.3. Properties
          1. 36.11.3.1. Example
        4. 36.11.4. Methods
          1. 36.11.4.1. Example
          2. 36.11.4.2. Example
      12. 36.12. TextRange Object
        1. 36.12.1. Syntax
        2. 36.12.2. About this object
        3. 36.12.3. Working with text ranges
        4. 36.12.4. About browser compatibility
        5. 36.12.5. Properties
          1. 36.12.5.1. Example
          2. 36.12.5.2. Example
          3. 36.12.5.3. Example
        6. 36.12.6. Methods
          1. 36.12.6.1. Example
          2. 36.12.6.2. Example
          3. 36.12.6.3. Example
          4. 36.12.6.4. Example
          5. 36.12.6.5. Example
          6. 36.12.6.6. Example
          7. 36.12.6.7. Example
          8. 36.12.6.8. Example
          9. 36.12.6.9. Example
          10. 36.12.6.10. Example
          11. 36.12.6.11. Example
          12. 36.12.6.12. Example
          13. 36.12.6.13. Example
          14. 36.12.6.14. Example
          15. 36.12.6.15. Example
          16. 36.12.6.16. Example
          17. 36.12.6.17. Example
          18. 36.12.6.18. Example
      13. 36.13. TextRectangle Object
        1. 36.13.1. Syntax
        2. 36.13.2. About this object
        3. 36.13.3. Properties
        4. 36.13.4.
          1. 36.13.4.1. Example
    2. 37. HTML Directive Objects
      1. 37-1. HTML Element Object
        1. 37-1.1. Syntax
        2. 37-1.2. About this object
        3. 37-1.3. Property
      2. 37-2. head Element Object
        1. 37-2.1. Syntax
        2. 37-2.2. About this object
        3. 37-2.3. Property
      3. 37-3. base Element Object
        1. 37-3.1. Syntax
        2. 37-3.2. About this object
        3. 37-3.3. Properties
      4. 37-4. link Element Object
        1. 37-4.1. Syntax
        2. 37-4.2. About this object
        3. 37-4.3. Properties
        4. 37-4.4. Event handlers
      5. 37-5. meta Element Object
        1. 37-5.1. Syntax
        2. 37-5.2. About this object
        3. 37-5.3. Properties
      6. 37-6. script Element Object
        1. 37-6.1. Syntax
        2. 37-6.2. About this object
        3. 37-6.3. Properties
      7. 37-7. title Element Object
        1. 37-7.1. Syntax
        2. 37-7.2. About this object
        3. 37-7.3. Property
    3. 38. Table and List Objects
      1. 38-1. The Table Object Family Hierarchy
        1. 38-1.1. Populating table cells
        2. 38-1.2. Modifying table cell content
        3. 38-1.3. Modifying table rows
        4. 38-1.4. Modifying table columns
        5. 38-1.5. W3C DOM table object classes
      2. 38-2. table Element Object
        1. 38-2.1. Syntax
        2. 38-2.2. About this object
        3. 38-2.3. Properties
          1. 38-2.3.1. Example
          2. 38-2.3.2. Example
          3. 38-2.3.3. Example
          4. 38-2.3.4. Example
          5. 38-2.3.5. Example
          6. 38-2.3.6. Example
          7. 38-2.3.7. Example
          8. 38-2.3.8. Example
          9. 38-2.3.9. Example
          10. 38-2.3.10. Example
          11. 38-2.3.11. Example
          12. 38-2.3.12. Example
          13. 38-2.3.13. Example
          14. 38-2.3.14. Example
        4. 38-2.4. Methods
          1. 38-2.4.1. Example
          2. 38-2.4.2. Example
          3. 38-2.4.3. Example
          4. 38-2.4.4. Example
      3. 38-3. tbody, tfoot, and thead Element Objects
        1. 38-3.1. Syntax
        2. 38-3.2. About these objects
        3. 38-3.3. Properties
          1. 38-3.3.1. Example
      4. 38-4. caption Element Object
        1. 38-4.1. Syntax
        2. 38-4.2. About this object
      5. 38-5. col and colgroup Element Objects
        1. 38-5.1. Syntax
        2. 38-5.2. About these objects
        3. 38-5.3. Properties
          1. 38-5.3.1. Example
      6. 38-6. tr Element Object
        1. 38-6.1. Syntax
        2. 38-6.2. About this object
        3. 38-6.3. Properties
          1. 38-6.3.1. Example
          2. 38-6.3.2. Example
          3. 38-6.3.3. Example
        4. 38-6.4. Methods
          1. 38-6.4.1. Example
      7. 38-7. td and th Element Objects
        1. 38-7.1. Syntax
        2. 38-7.2. About these objects
        3. 38-7.3. Properties
          1. 38-7.3.1. Example
          2. 38-7.3.2. Example
          3. 38-7.3.3. Example
          4. 38-7.3.4. Example
      8. 38-8. ol Element Object
        1. 38-8.1. Syntax
        2. 38-8.2. About this object
        3. 38-8.3. Properties
          1. 38-8.3.1. Example
          2. 38-8.3.2. Example
      9. 38-9. ul Element Object
        1. 38-9.1. Syntax
        2. 38-9.2. About this object
        3. 38-9.3. Properties
          1. 38-9.3.1. Example
      10. 38-10. li Element Object
        1. 38-10.1. Syntax
        2. 38-10.2. About this object
        3. 38-10.3. Properties
          1. 38-10.3.1. Example
          2. 38-10.3.2. Example
      11. 38-11. dl, dt, and dd Element Objects
        1. 38-11.1. Syntax
        2. 38-11.2. About these objects
        3. 38-11.3. Properties
      12. 38-12. dir and menu Element Objects
        1. 38-12.1. Syntax
        2. 38-12.2. About these objects
    4. 39. The Navigator and Other Environment Objects
      1. 39-1. clientInformation Object (IE4+) and navigator Object (All)
        1. 39-1.1. Syntax
        2. 39-1.2. About this object
        3. 39-1.3. Properties
        4. 39-1.4. Using the appVersion property
        5. 39-1.5. userAgent property details
          1. 39-1.5.1. Example
          2. 39-1.5.2. Example
          3. 39-1.5.3. Example
          4. 39-1.5.4. Example
          5. 39-1.5.5. Example
          6. 39-1.5.6. Example
          7. 39-1.5.7. Example
          8. 39-1.5.8. Example
          9. 39-1.5.9. Example
          10. 39-1.5.10. Example
          11. 39-1.5.11. Example
        6. 39-1.6. Methods
          1. 39-1.6.1. Example
      2. 39-2. mimeType Object
        1. 39-2.1. Syntax
        2. 39-2.2. About this object
        3. 39-2.3. Properties
          1. 39-2.3.1. Example
          2. 39-2.3.2. Example
          3. 39-2.3.3. Example
      3. 39-3. plugin Object
        1. 39-3.1. Syntax
        2. 39-3.2. About this object
        3. 39-3.3. Properties
          1. 39-3.3.1. Example
        4. 39-3.4. Methods
      4. 39-4. Looking for mime Types and Plug-ins
        1. 39-4.1. Overview: Using mimeType and plugin objects
        2. 39-4.2. Verifying a mime type
        3. 39-4.3. Verifying a plug-in
        4. 39-4.4. Verifying both plug-in and mime type
        5. 39-4.5. Managing manual plug-in installation
        6. 39-4.6. "Plug-in" detection in WinIE
          1. 39-4.6.1. Tracking down plug-in details
          2. 39-4.6.2. Setting a minimum version number
          3. 39-4.6.3. When an object requires VBScript
      5. 39-5. screen Object
        1. 39-5.1. Syntax
        2. 39-5.2. About this object
        3. 39-5.3. Properties
          1. 39-5.3.1. Example
      6. 39-6. userProfile Object
        1. 39-6.1. Syntax
        2. 39-6.2. About this object
        3. 39-6.3. Methods
          1. 39-6.3.1. Example
          2. 39-6.3.2. Example
          3. 39-6.3.3. Example
    5. 40. Positioned Objects
      1. 40-1. What Is a Layer?
      2. 40-2. Positioned Elements in the Modern DOM
        1. 40-2.1. Changing element backgrounds
        2. 40-2.2. Layer clipping
        3. 40-2.3. Scripting nested layers
        4. 40-2.4. Loading external HTML into a layer
        5. 40-2.5. Positioned element visibility behavior
        6. 40-2.6. Scripting layer stacking order
        7. 40-2.7. Dragging and resizing a layer
    6. 41. Embedded Objects
      1. 41-1. applet Element Object
        1. 41-1.1. Syntax
        2. 41-1.2. About this object
        3. 41-1.3. Properties
      2. 41-2. object Element Object
        1. 41-2.1. Syntax
        2. 41-2.2. About this object
        3. 41-2.3. Properties
      3. 41-3. embed Element Object
        1. 41-3.1. Syntax
        2. 41-3.2. About this object
        3. 41-3.3. Properties
      4. 41-4. The Odd Case of the param Element
    7. 42. The Regular Expression and RegExp Objects
      1. 42-1. Regular Expressions and Patterns
      2. 42-2. Language Basics
        1. 42-2.1. Simple patterns
        2. 42-2.2. Special characters
        3. 42-2.3. Grouping and backreferencing
      3. 42-3. Object Relationships
      4. 42-4. Using Regular Expressions
        1. 42-4.1. Is there a match?
        2. 42-4.2. Getting information about a match
        3. 42-4.3. String replacement
      5. 42-5. Regular Expression Object
        1. 42-5.1. Syntax
        2. 42-5.2. About this object
        3. 42-5.3. Properties
        4. 42-5.4. Methods
      6. 42-6. RegExp Object
        1. 42-6.1. Syntax
        2. 42-6.2. About this object
        3. 42-6.3. Properties
    8. 43. Data-Entry Validation
      1. 43-1. Real-Time versus Batch Validation
        1. 43-1.1. Real-time validation triggers
        2. 43-1.2. Batch mode validation
      2. 43-2. Designing Filters
      3. 43-3. Building a Library of Filter Functions
        1. 43-3.1. isEmpty()
        2. 43-3.2. isPosInteger()
        3. 43-3.3. isInteger()
        4. 43-3.4. isNumber()
        5. 43-3.5. Custom validation functions
      4. 43-4. Combining Validation Functions
      5. 43-5. Date and Time Validation
      6. 43-6. An Industrial-Strength Validation Solution
        1. 43-6.1. Structure
        2. 43-6.2. Dispatch mechanism
        3. 43-6.3. Sample validations
          1. 43-6.3.1. U.S. state name
          2. 43-6.3.2. Date validation
          3. 43-6.3.3. Cross-confirmation fields
        4. 43-6.4. Last-minute check
        5. 43-6.5. Try it out
      7. 43-7. Plan for Data Validation
    9. 44. Scripting Java Applets and Plug-Ins
      1. 44-1. NPAPI Overview
      2. 44-2. Why Control Java Applets?
      3. 44-3. A Little Java
        1. 44-3.1. Java building blocks classes
        2. 44-3.2. Java methods
        3. 44-3.3. Java applet "properties"
        4. 44-3.4. Accessing Java fields
      4. 44-4. Scripting Applets in Real Life
        1. 44-4.1. Getting to scriptable methods
        2. 44-4.2. Applet limitations
        3. 44-4.3. Faceless applets
        4. 44-4.4. Data type conversions
      5. 44-5. Applet-to-Script Communication
        1. 44-5.1. What your applet needs
        2. 44-5.2. What your HTML needs
        3. 44-5.3. About JSObject class
        4. 44-5.4. Data type conversions
        5. 44-5.5. Example applet-to-script application
      6. 44-6. Scripting Plug-ins
        1. 44-6.1. The HTML side
        2. 44-6.2. The API approach
          1. 44-6.2.1. Loading the library
          2. 44-6.2.2. Initializing the library
          3. 44-6.2.3. Sound player API objects
          4. 44-6.2.4. Invoking methods
        3. 44-6.3. Building a jukebox
        4. 44-6.4. Embedding multiple sounds
      7. 44-7. Scripting Java Classes Directly
    10. 45. Debugging Scripts
      1. 45-1. Syntax versus Runtime Errors
      2. 45-2. Error Message Notification
        1. 45-2.1. Mozilla console windows
        2. 45-2.2. Safari errors
        3. 45-2.3. Multiple error messages
      3. 45-3. Error Message Details
        1. 45-3.1. Error filename
        2. 45-3.2. Error location
        3. 45-3.3. Error message text
          1. 45-3.3.1. "Object expected"
          2. 45-3.3.2. "Expected <something>"
          3. 45-3.3.3. "<Something> is undefined"
          4. 45-3.3.4. "<Something> is not a function"
          5. 45-3.3.5. "Object doesn't support this property or method"
          6. 45-3.3.6. "Unterminated string literal": "Unterminated string constant"
          7. 45-3.3.7. "Missing } after function body": "Expected }"
          8. 45-3.3.8. "<Something> is not a number"
          9. 45-3.3.9. "<Something> has no property named . . .": "<Something> has no properties"
          10. 45-3.3.10. "<Something> is null or not an object"
          11. 45-3.3.11. "<Something> has no property indexed by [i]"
          12. 45-3.3.12. "<Something> can't be set by assignment"
          13. 45-3.3.13. "Test for equality (==) mistyped as assignment (=)? Assuming equality test."
          14. 45-3.3.14. "Function does not always return a value"
          15. 45-3.3.15. "Access disallowed from scripts at <URL> to documents at <URL>": "Access is denied"
          16. 45-3.3.16. "Unspecified error"
          17. 45-3.3.17. "Uncaught exception"
          18. 45-3.3.18. "Too many JavaScript errors"
      4. 45-4. Warnings in Mozilla's Console
      5. 45-5. Sniffing Out Problems
        1. 45-5.1. Check the HTML tags
        2. 45-5.2. View the source
        3. 45-5.3. Timing problems
        4. 45-5.4. Reopen the file
        5. 45-5.5. Find out what works
        6. 45-5.6. Comment out statements
        7. 45-5.7. Check runtime expression evaluation
      6. 45-6. Debugging Tools
        1. 45-6.1. WinIE Script Debugger
        2. 45-6.2. Mozilla's Venkman Debugger
        3. 45-6.3. Firefox's FireBug Debugger
        4. 45-6.4. Safari's Drosera Debugger
        5. 45-6.5. Using the embeddable Evaluator
        6. 45-6.6. Emergency evaluation
      7. 45-7. A Simple Trace Utility
        1. 45-7.1. The trace() function
        2. 45-7.2. Preparing documents for trace.js
        3. 45-7.3. Invoking trace()
      8. 45-8. Browser Crashes
      9. 45-9. Preventing Problems
        1. 45-9.1. Getting structure right
        2. 45-9.2. Build incrementally
        3. 45-9.3. Test expression evaluation
        4. 45-9.4. Build function workbenches
      10. 45-10. Testing Your Masterpiece
    11. 46. Security and Netscape Signed Scripts
      1. 46-1. Battening Down the Hatches
      2. 46-2. When Worlds Collide
      3. 46-3. The Java Sandbox
      4. 46-4. Security Policies
      5. 46-5. The Same Origin Policy
        1. 46-5.1. Setting the document.domain
        2. 46-5.2. Origin checks
          1. 46-5.2.1. Window object checks
          2. 46-5.2.2. Location object checks
          3. 46-5.2.3. Document object checks
          4. 46-5.2.4. Form object checks
          5. 46-5.2.5. Applet object checks
          6. 46-5.2.6. Image object checks
          7. 46-5.2.7. Linked script library checks
      6. 46-6. The Netscape Signed Script Policy
        1. 46-6.1. Signed objects and scripts
        2. 46-6.2. What you get with signed scripts
      7. 46-7. The Digital Certificate
        1. 46-7.1. How to get a certificate
        2. 46-7.2. Activating the codebase principal
      8. 46-8. Signing Scripts
        1. 46-8.1. Signing tool
        2. 46-8.2. Preparing scripts for signing
        3. 46-8.3. Accessing signed scripts
        4. 46-8.4. Editing and moving signed scripts
      9. 46-9. Accessing Protected Properties and Methods
        1. 46-9.1. Gaining privileges
        2. 46-9.2. Specifying a target
      10. 46-10. Blending Privileges into Scripts
        1. 46-10.1. Keep the window small
        2. 46-10.2. Think of the users
      11. 46-11. Examples
        1. 46-11.1. Accessing private browser information
        2. 46-11.2. Accessing a protected window property
      12. 46-12. Handling Privilege Manager Errors
      13. 46-13. Signed Script Miscellany
        1. 46-13.1. Exporting and importing signed scripts
        2. 46-13.2. Locking down your signed pages
        3. 46-13.3. International characters
    12. 47. Cross-Browser Dynamic HTML Issues
      1. 47-1. What Is DHTML?
      2. 47-2. Striving for Compatibility
      3. 47-3. Working Around Incompatibilities
        1. 47-3.1. Old-fashioned compatibility tricks
          1. 47-3.1.1. Inline branching
          2. 47-3.1.2. Platform equivalency
        2. 47-3.2. Modern approaches to compatibility
          1. 47-3.2.1. Object detection
          2. 47-3.2.2. Custom APIs
        3. 47-3.3. Handling non-DHTML browsers
      4. 47-4. A DHTML API Example
    13. 48. Internet Explorer Behaviors
      1. 48-1. Stylesheets for Scripts
      2. 48-2. Embedding Behavior Components
        1. 48-2.1. Linking in a behavior component
        2. 48-2.2. Enabling and disabling behaviors
      3. 48-3. Component Structure
        1. 48-3.1. Script statements
        2. 48-3.2. Variable scope
        3. 48-3.3. Assigning event handlers
        4. 48-3.4. Exposing properties and methods
      4. 48-4. Behavior Examples
        1. 48-4.1. Example 1: Element dragging behavior
        2. 48-4.2. Example 2: Text rollover behavior
      5. 48-5. For More Information
    14. 49. Application: Tables and Calendars
      1. 49-1. About the Calendars
      2. 49-2. Static Tables
      3. 49-3. Dynamic Tables
      4. 49-4. Hybrids
      5. 49-5. Dynamic HTML Tables
      6. 49-6. Further Thoughts
    15. 50. Application: A Lookup Table
      1. 50-1. A Serverless Database
      2. 50-2. The Database
      3. 50-3. The Implementation Plan
      4. 50-4. The Code
      5. 50-5. Further Thoughts
    16. 51. Application: A Poor Man's Order Form
      1. 51-1. Defining the Task
      2. 51-2. The Form Design
      3. 51-3. Form HTML and Scripting
        1. 51-3.1. Global adjustments
        2. 51-3.2. Do the math
        3. 51-3.3. Cooking up some HTML
        4. 51-3.4. Tedium lost
        5. 51-3.5. Tedium regained
      4. 51-4. Further Thoughts
    17. 52. Application: Outline-Style Table of Contents
      1. 52-1. The Implementation Plan
      2. 52-2. The Code
        1. 52-2.1. Setting the frames
        2. 52-2.2. Outline code
        3. 52-2.3. Assembling outline content
      3. 52-3. An Ajax (XML) Outline
        1. 52-3.1. Birth of an XML specification
        2. 52-3.2. OPML outliner prep
        3. 52-3.3. The XML and HTML code
        4. 52-3.4. Setting the scripted stage
        5. 52-3.5. Accumulating the HTML
        6. 52-3.6. Toggling node expansion
        7. 52-3.7. Wrap up
      4. 52-4. Further Thoughts
    18. 53. Application: Calculations and Graphics
      1. 53-1. The Calculation
      2. 53-2. User Interface Ideas
      3. 53-3. The Code
        1. 53-3.1. Basic arrays
        2. 53-3.2. Calculations and formatting
        3. 53-3.3. Preloading images
        4. 53-3.4. Changing images on the fly
        5. 53-3.5. Creating the select objects
        6. 53-3.6. Drawing the initial images
      4. 53-4. Further Thoughts
    19. 54. Application: Intelligent "Updated" Flags
      1. 54-1. The Cookie Conundrum
      2. 54-2. Time's Not on Your Side
      3. 54-3. The Application
      4. 54-4. The Code
        1. 54-4.1. Setting the stage
        2. 54-4.2. The date comparison
        3. 54-4.3. A live <body>
      5. 54-5. Further Thoughts
    20. 55. Application: Decision Helper
      1. 55-1. The Application
      2. 55-2. The Design
      3. 55-3. The Files
      4. 55-4. The Code
        1. 55-4.1. index.htm
        2. 55-4.2. dhNav.htm
        3. 55-4.3. dh1.htm
        4. 55-4.4. dh2.htm
        5. 55-4.5. dh3.htm
        6. 55-4.6. dh4.htm
        7. 55-4.7. dh5.htm
        8. 55-4.8. dhHelp.htm
      5. 55-5. Further Thoughts
    21. 56. Application: Cross-Browser DHTML Map Puzzle
      1. 56-1. The Puzzle Design
      2. 56-2. Implementation Details
        1. 56-2.1. The custom API
        2. 56-2.2. The main program
      3. 56-3. Lessons Learned
    22. 57. Application: Transforming XML Data
      1. 57-1. Application Overview
      2. 57-2. Implementation Plan
      3. 57-3. The Code
        1. 57-3.1. Style sheets
        2. 57-3.2. Initialization sequence
        3. 57-3.3. Converting the data
        4. 57-3.4. Sorting the JavaScript database
        5. 57-3.5. Constructing the table
        6. 57-3.6. select controls
      4. 57-4. Dreams of Other Views
    23. 58. Application: Creating Custom Google Maps
      1. 58-1. A Google Maps Primer
      2. 58-2. Google Maps Customization Basics
        1. 58-2.1. Getting your own API key
        2. 58-2.2. Inside the Google Maps API
        3. 58-2.3. Obtaining the geocoordinates of a location
      3. 58-3. Designing a Google Maps Mashup
      4. 58-4. Developing a Custom Map Document
      5. 58-5. Hacking Together a Custom Google Map
        1. 58-5.1. Displaying the custom map
        2. 58-5.2. Styling a custom information window
        3. 58-5.3. Testing the finished map
      6. 58-6. Further Thoughts