JavaScript: The Definitive Guide, 5th Edition

Book description

This Fifth Edition is completely revised and expanded to cover JavaScript as it is used in today's Web 2.0 applications. This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including:



  • Scripted HTTP and Ajax
  • XML processing
  • Client-side graphics using the canvas tag
  • Namespaces in JavaScript--essential when writing complex programs
  • Classes, closures, persistence, Flash, and JavaScript embedded in Java applications


Part I explains the core JavaScript language in detail. If you are new to JavaScript, it will teach you the language. If you are already a JavaScript programmer, Part I will sharpen your skills and deepen your understanding of the language.



Part II explains the scripting environment provided by web browsers, with a focus on DOM scripting with unobtrusive JavaScript. The broad and deep coverage of client-side JavaScript is illustrated with many sophisticated examples that demonstrate how to:



  • Generate a table of contents for an HTML document
  • Display DHTML animations
  • Automate form validation
  • Draw dynamic pie charts
  • Make HTML elements draggable
  • Define keyboard shortcuts for web applications
  • Create Ajax-enabled tool tips
  • Use XPath and XSLT on XML documents loaded with Ajax
  • And much more


Part III is a complete reference for core JavaScript. It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript Version 3.



Part IV is a reference for client-side JavaScript, covering legacy web browser APIs, the standard Level 2 DOM API, and emerging standards such as the XMLHttpRequest object and the canvas tag.



More than 300,000 JavaScript programmers around the world have madethis their indispensable reference book for building JavaScript applications.



"A must-have reference for expert JavaScript programmers...well-organized and detailed."
-- Brendan Eich, creator of JavaScript

Publisher resources

View/Submit Errata

Table of contents

  1. A Note Regarding Supplemental Files
  2. Dedication
  3. Preface
    1. What’s New in the Fifth Edition
    2. Using This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Enabled
    6. How to Contact Us
    7. Acknowledgments
  4. 1. Introduction to JavaScript
    1. 1.1. What Is JavaScript?
      1. 1.1.1. JavaScript Is Not Java
      2. 1.1.2. JavaScript Is Not Simple
    2. 1.2. Versions of JavaScript
    3. 1.3. Client-Side JavaScript
      1. 1.3.1. Client-Side JavaScript Examples
    4. 1.4. JavaScript in Other Contexts
    5. 1.5. Exploring JavaScript
  5. I. Core JavaScript
    1. 2. Lexical Structure
      1. 2.1. Character Set
      2. 2.2. Case Sensitivity
      3. 2.3. Whitespace and Line Breaks
      4. 2.4. Optional Semicolons
      5. 2.5. Comments
      6. 2.6. Literals
      7. 2.7. Identifiers
      8. 2.8. Reserved Words
    2. 3. Datatypes and Values
      1. 3.1. Numbers
        1. 3.1.1. Integer Literals
        2. 3.1.2. Hexadecimal and Octal Literals
        3. 3.1.3. Floating-Point Literals
        4. 3.1.4. Working with Numbers
        5. 3.1.5. Numeric Conversions
        6. 3.1.6. Special Numeric Values
      2. 3.2. Strings
        1. 3.2.1. String Literals
        2. 3.2.2. Escape Sequences in String Literals
        3. 3.2.3. Working with Strings
        4. 3.2.4. Converting Numbers to Strings
        5. 3.2.5. Converting Strings to Numbers
      3. 3.3. Boolean Values
        1. 3.3.1. Boolean Type Conversions
      4. 3.4. Functions
        1. 3.4.1. Function Literals
      5. 3.5. Objects
        1. 3.5.1. Creating Objects
        2. 3.5.2. Object Literals
        3. 3.5.3. Object Conversions
      6. 3.6. Arrays
        1. 3.6.1. Creating Arrays
        2. 3.6.2. Array Literals
      7. 3.7. null
      8. 3.8. undefined
      9. 3.9. The Date Object
      10. 3.10. Regular Expressions
      11. 3.11. Error Objects
      12. 3.12. Type Conversion Summary
      13. 3.13. Primitive Datatype Wrapper Objects
      14. 3.14. Object-to-Primitive Conversion
      15. 3.15. By Value Versus by Reference
        1. 3.15.1. Primitive Types and Reference Types
        2. 3.15.2. Copying and Passing Strings
        3. 3.15.3. Comparing Strings
        4. 3.15.4. By Value Versus by Reference: Summary
    3. 4. Variables
      1. 4.1. Variable Typing
      2. 4.2. Variable Declaration
        1. 4.2.1. Repeated and Omitted Declarations
      3. 4.3. Variable Scope
        1. 4.3.1. No Block Scope
        2. 4.3.2. Undefined Versus Unassigned
      4. 4.4. Primitive Types and Reference Types
      5. 4.5. Garbage Collection
      6. 4.6. Variables as Properties
        1. 4.6.1. The Global Object
        2. 4.6.2. Local Variables: The Call Object
        3. 4.6.3. JavaScript Execution Contexts
      7. 4.7. Variable Scope Revisited
    4. 5. Expressions and Operators
      1. 5.1. Expressions
      2. 5.2. Operator Overview
        1. 5.2.1. Number of Operands
        2. 5.2.2. Type of Operands
        3. 5.2.3. Operator Precedence
        4. 5.2.4. Operator Associativity
      3. 5.3. Arithmetic Operators
      4. 5.4. Equality Operators
        1. 5.4.1. Equality (==) and Identity (===)
        2. 5.4.2. Inequality (!=) and Nonidentity (!==)
      5. 5.5. Relational Operators
        1. 5.5.1. Comparison Operators
        2. 5.5.2. The in Operator
        3. 5.5.3. The instanceof Operator
      6. 5.6. String Operators
      7. 5.7. Logical Operators
        1. 5.7.1. Logical AND (&&)
        2. 5.7.2. Logical OR (||)
        3. 5.7.3. Logical NOT (!)
      8. 5.8. Bitwise Operators
      9. 5.9. Assignment Operators
        1. 5.9.1. Assignment with Operation
      10. 5.10. Miscellaneous Operators
        1. 5.10.1. The Conditional Operator (?:)
        2. 5.10.2. The typeof Operator
        3. 5.10.3. The Object-Creation Operator (new)
        4. 5.10.4. The delete Operator
        5. 5.10.5. The void Operator
        6. 5.10.6. The Comma Operator (,)
        7. 5.10.7. Array and Object Access Operators
        8. 5.10.8. The Function Call Operator
    5. 6. Statements
      1. 6.1. Expression Statements
      2. 6.2. Compound Statements
      3. 6.3. if
      4. 6.4. else if
      5. 6.5. switch
      6. 6.6. while
      7. 6.7. do/while
      8. 6.8. for
      9. 6.9. for/in
      10. 6.10. Labels
      11. 6.11. break
      12. 6.12. continue
      13. 6.13. var
      14. 6.14. function
      15. 6.15. return
      16. 6.16. throw
      17. 6.17. try/catch/finally
      18. 6.18. with
      19. 6.19. The Empty Statement
      20. 6.20. Summary of JavaScript Statements
    6. 7. Objects and Arrays
      1. 7.1. Creating Objects
      2. 7.2. Object Properties
        1. 7.2.1. Enumerating Properties
        2. 7.2.2. Checking Property Existence
        3. 7.2.3. Deleting Properties
      3. 7.3. Objects as Associative Arrays
      4. 7.4. Universal Object Properties and Methods
        1. 7.4.1. The constructor Property
        2. 7.4.2. The toString() Method
        3. 7.4.3. The toLocaleString() Method
        4. 7.4.4. The valueOf() Method
        5. 7.4.5. The hasOwnProperty() Method
        6. 7.4.6. The propertyIsEnumerable() Method
        7. 7.4.7. The isPrototypeOf() Method
      5. 7.5. Arrays
      6. 7.6. Reading and Writing Array Elements
        1. 7.6.1. Adding New Elements to an Array
        2. 7.6.2. Deleting Array Elements
        3. 7.6.3. Array Length
        4. 7.6.4. Iterating Through Arrays
        5. 7.6.5. Truncating and Enlarging Arrays
        6. 7.6.6. Multidimensional Arrays
      7. 7.7. Array Methods
        1. 7.7.1. join()
        2. 7.7.2. reverse()
        3. 7.7.3. sort()
        4. 7.7.4. concat()
        5. 7.7.5. slice()
        6. 7.7.6.. splice()
        7. 7.7.7. push() and pop()
        8. 7.7.8. unshift() and shift()
        9. 7.7.9. toString() and toLocaleString()
        10. 7.7.10. Array Extras
      8. 7.8. Array-Like Objects
    7. 8. Functions
      1. 8.1. Defining and Invoking Functions
        1. 8.1.1. Nested Functions
        2. 8.1.2. Function Literals
        3. 8.1.3. Naming Functions
      2. 8.2. Function Arguments
        1. 8.2.1. Optional Arguments
        2. 8.2.2. Variable-Length Argument Lists: The Arguments Object
          1. 8.2.2.1. The callee Property
        3. 8.2.3. Using Object Properties as Arguments
        4. 8.2.4. Argument Types
      3. 8.3. Functions as Data
      4. 8.4. Functions as Methods
      5. 8.5. Constructor Functions
      6. 8.6. Function Properties and Methods
        1. 8.6.1. The length Property
        2. 8.6.2. The prototype Property
        3. 8.6.3. Defining Your Own Function Properties
        4. 8.6.4. The apply() and call() Methods
      7. 8.7. Utility Function Examples
      8. 8.8. Function Scope and Closures
        1. 8.8.1. Lexical Scoping
        2. 8.8.2. The Call Object
        3. 8.8.3. The Call Object as a Namespace
        4. 8.8.4. Nested Functions as Closures
          1. 8.8.4.1. Closure examples
          2. 8.8.4.2. Closures and memory leaks in Internet Explorer
      9. 8.9. The Function() Constructor
    8. 9. Classes, Constructors, and Prototypes
      1. 9.1. Constructors
      2. 9.2. Prototypes and Inheritance
        1. 9.2.1. Reading and Writing Inherited Properties
        2. 9.2.2. Extending Built-in Types
      3. 9.3. Simulating Classes in JavaScript
        1. 9.3.1. Instance Properties
        2. 9.3.2. Instance Methods
          1. 9.3.2.1. Instance methods and this
        3. 9.3.3. Class Properties
        4. 9.3.4. Class Methods
        5. 9.3.5. Example: A Circle Class
        6. 9.3.6. Example: Complex Numbers
        7. 9.3.7. Private Members
      4. 9.4. Common Object Methods
        1. 9.4.1. The toString( ) Method
        2. 9.4.2. The valueOf( ) Method
        3. 9.4.3. Comparison Methods
      5. 9.5. Superclasses and Subclasses
        1. 9.5.1. Constructor Chaining
        2. 9.5.2. Invoking Overridden Methods
      6. 9.6. Extending Without Inheriting
      7. 9.7. Determining Object Type
        1. 9.7.1. instanceof and constructor
        2. 9.7.2. Object.toString( ) for Object Typing
        3. 9.7.3. Duck Typing
      8. 9.8. Example: A defineClass( ) Utility Method
    9. 10. Modules and Namespaces
      1. 10.1. Creating Modules and Namespaces
        1. 10.1.1. Testing the Availability of a Module
        2. 10.1.2. Classes as Modules
        3. 10.1.3. Module Initialization Code
      2. 10.2. Importing Symbols from Namespaces
        1. 10.2.1. Public and Private Symbols
        2. 10.2.2. Closures as Private Namespace and Scope
      3. 10.3. Module Utilities
    10. 11. Pattern Matching with Regular Expressions
      1. 11.1. Defining Regular Expressions
        1. 11.1.1. Literal Characters
        2. 11.1.2. Character Classes
        3. 11.1.3. Repetition
          1. 11.1.3.1. Nongreedy repetition
        4. 11.1.4. Alternation, Grouping, and References
        5. 11.1.5. Specifying Match Position
        6. 11.1.6. Flags
        7. 11.1.7. Perl RegExp Features Not Supported in JavaScript
      2. 11.2. String Methods for Pattern Matching
      3. 11.3. The RegExp Object
        1. 11.3.1. RegExp Methods for Pattern Matching
        2. 11.3.2. RegExp Instance Properties
    11. 12. Scripting Java
      1. 12.1. Embedding JavaScript
        1. 12.1.1. Type Conversion with javax.script
        2. 12.1.2. Compiling Scripts
        3. 12.1.3. Invoking JavaScript Functions
        4. 12.1.4. Implementing Interfaces in JavaScript
      2. 12.2. Scripting Java
        1. 12.2.1. The JavaPackage Class
        2. 12.2.2. The JavaClass Class
        3. 12.2.3. Importing Packages and Classes
        4. 12.2.4. The JavaObject Class
        5. 12.2.5. Java Methods
          1. 12.2.5.1. Property accessor methods
          2. 12.2.5.2. Overloaded methods
        6. 12.2.6. The JavaArray Class
          1. 12.2.6.1. Creating Java arrays
        7. 12.2.7. Implementing Interfaces with LiveConnect
        8. 12.2.8. LiveConnect Data Conversion
          1. 12.2.8.1. JavaScript conversion of JavaObjects
  6. II. Client-Side JavaScript
    1. 13. JavaScript in Web Browsers
      1. 13.1. The Web Browser Environment
        1. 13.1.1. The Window as Global Execution Context
        2. 13.1.2. The Client-Side Object Hierarchy and the DOM
        3. 13.1.3. The Event-Driven Programming Model
        4. 13.1.4. The Role of JavaScript on the Web
        5. 13.1.5. Unobtrusive JavaScript
      2. 13.2. Embedding Scripts in HTML
        1. 13.2.1. The <script> Tag
        2. 13.2.2. Scripts in External Files
        3. 13.2.3. Specifying the Scripting Language
        4. 13.2.4. The defer Attribute
        5. 13.2.5. The <noscript> Tag
        6. 13.2.6. The </script> Tag
        7. 13.2.7. Hiding Scripts from Old Browsers
        8. 13.2.8. Nonstandard Script Attributes
      3. 13.3. Event Handlers in HTML
      4. 13.4. JavaScript in URLs
        1. 13.4.1. Bookmarklets
      5. 13.5. Execution of JavaScript Programs
        1. 13.5.1. Executing Scripts
        2. 13.5.2. The onload Event Handler
        3. 13.5.3. Event Handlers and JavaScript URLs
        4. 13.5.4. The onunload Event Handler
        5. 13.5.5. The Window Object as Execution Context
        6. 13.5.6. Client-Side JavaScript Threading Model
        7. 13.5.7. Manipulating the Document During Loading
      6. 13.6. Client-Side Compatibility
        1. 13.6.1. The History of Incompatibility
        2. 13.6.2. A Word about “Modern Browsers”
        3. 13.6.3. Feature Testing
        4. 13.6.4. Browser Testing
        5. 13.6.5. Conditional Comments in Internet Explorer
      7. 13.7. Accessibility
      8. 13.8. JavaScript Security
        1. 13.8.1. What JavaScript Can’t Do
        2. 13.8.2. The Same-Origin Policy
        3. 13.8.3. Scripting Plug-ins and ActiveX Controls
        4. 13.8.4. Cross-Site Scripting
        5. 13.8.5. Denial-of-Service Attacks
      9. 13.9. Other Web-Related JavaScript Embeddings
    2. 14. Scripting Browser Windows
      1. 14.1. Timers
      2. 14.2. Browser Location and History
        1. 14.2.1. Parsing URLs
        2. 14.2.2. Loading New Documents
        3. 14.2.3. The History Object
      3. 14.3. Obtaining Window, Screen, and Browser Information
        1. 14.3.1. Window Geometry
        2. 14.3.2. The Screen Object
        3. 14.3.3. The Navigator Object
      4. 14.4. Opening and Manipulating Windows
        1. 14.4.1. Opening Windows
        2. 14.4.2. Closing Windows
        3. 14.4.3. Window Geometry
        4. 14.4.4. Keyboard Focus and Visibility
        5. 14.4.5. Scrolling
        6. 14.4.6. Window Methods Example
      5. 14.5. Simple Dialog Boxes
      6. 14.6. Scripting the Status Line
      7. 14.7. Error Handling
      8. 14.8. Multiple Windows and Frames
        1. 14.8.1. Relationships Between Frames
        2. 14.8.2. Window and Frame Names
        3. 14.8.3. JavaScript in Interacting Windows
      9. 14.9. Example: A Navigation Bar in a Frame
    3. 15. Scripting Documents
      1. 15.1. Dynamic Document Content
      2. 15.2. Document Properties
      3. 15.3. Legacy DOM: Document Object Collections
        1. 15.3.1. Naming Document Objects
        2. 15.3.2. Event Handlers on Document Objects
        3. 15.3.3. Legacy DOM Example
      4. 15.4. Overview of the W3C DOM
        1. 15.4.1. Representing Documents as Trees
        2. 15.4.2. Nodes
          1. 15.4.2.1. Types of nodes
          2. 15.4.2.2. Attributes
        3. 15.4.3. The DOM HTML API
          1. 15.4.3.1. HTML naming conventions
        4. 15.4.4. DOM Levels and Features
        5. 15.4.5. DOM Conformance
          1. 15.4.5.1. DOM conformance in Internet Explorer
        6. 15.4.6. Language-Independent DOM Interfaces
      5. 15.5. Traversing a Document
      6. 15.6. Finding Elements in a Document
      7. 15.7. Modifying a Document
        1. 15.7.1. Modifying Attributes
        2. 15.7.2. Working with Document Fragments
      8. 15.8. Adding Content to a Document
        1. 15.8.1. Convenience Methods for Creating Nodes
        2. 15.8.2. The innerHTML Property
      9. 15.9. Example: A Dynamically Created Table of Contents
      10. 15.10. Querying Selected Text
      11. 15.11. The IE 4 DOM
        1. 15.11.1. Traversing a Document
        2. 15.11.2. Finding Document Elements
        3. 15.11.3. Modifying Documents
    4. 16. Cascading Style Sheets and Dynamic HTML
      1. 16.1. Overview of CSS
        1. 16.1.1. Applying Style Rules to Document Elements
        2. 16.1.2. Associating Stylesheets with Documents
        3. 16.1.3. The Cascade
        4. 16.1.4. Versions of CSS
        5. 16.1.5. CSS Example
      2. 16.2. CSS for DHTML
        1. 16.2.1. The Key to DHTML: Absolute Positioning
        2. 16.2.2. CSS Positioning Example: Shadowed Text
        3. 16.2.3. Querying Element Position and Size
        4. 16.2.4. The Third Dimension: z-index
        5. 16.2.5. Element Display and Visibility
        6. 16.2.6. The CSS Box Model and Positioning Details
          1. 16.2.6.1. Internet Explorer quirks
        7. 16.2.7. Color, Transparency, and Translucency
        8. 16.2.8. Partial Visibility: overflow and clip
        9. 16.2.9. Example: Overlapping Translucent Windows
      3. 16.3. Scripting Inline Styles
        1. 16.3.1. Naming Conventions: CSS Attributes in JavaScript
        2. 16.3.2. Working with Style Properties
        3. 16.3.3. Example: CSS Tool Tips
        4. 16.3.4. DHTML Animations
      4. 16.4. Scripting Computed Styles
      5. 16.5. Scripting CSS Classes
      6. 16.6. Scripting Stylesheets
        1. 16.6.1. Enabling and Disabling Stylesheets
        2. 16.6.2. Stylesheet Objects and Stylesheet Rules
    5. 17. Events and Event Handling
      1. 17.1. Basic Event Handling
        1. 17.1.1. Events and Event Types
          1. 17.1.1.1. Device-dependent and device-independent events
        2. 17.1.2. Event Handlers as Attributes
        3. 17.1.3. Event Handlers as Properties
          1. 17.1.3.1. Explicitly invoking event handlers
        4. 17.1.4. Event Handler Return Values
        5. 17.1.5. Event Handlers and the this Keyword
        6. 17.1.6. Scope of Event Handlers
      2. 17.2. Advanced Event Handling with DOM Level 2
        1. 17.2.1. Event Propagation
        2. 17.2.2. Event Handler Registration
        3. 17.2.3. addEventListener( ) and the this Keyword
        4. 17.2.4. Registering Objects as Event Handlers
        5. 17.2.5. Event Modules and Event Types
        6. 17.2.6. Event Interfaces and Event Details
          1. 17.2.6.1. Event
          2. 17.2.6.2. UIEvent
          3. 17.2.6.3. MouseEvent
        7. 17.2.7. Mixing Event Models
      3. 17.3. The Internet Explorer Event Model
        1. 17.3.1. The IE Event Object
        2. 17.3.2. The IE Event Object as a Global Variable
        3. 17.3.3. IE Event-Handler Registration
        4. 17.3.4. Event Bubbling in IE
        5. 17.3.5. Capturing Mouse Events
        6. 17.3.6. attachEvent( ) and the this Keyword
        7. 17.3.7. Event Handlers and Memory Leaks
        8. 17.3.8. Example: Event Model Compatibility for IE
      4. 17.4. Mouse Events
        1. 17.4.1. Converting Mouse Coordinates
        2. 17.4.2. Example: Dragging Document Elements
      5. 17.5. Key Events
        1. 17.5.1. Types of Key Events
        2. 17.5.2. Key Event Details
        3. 17.5.3. Filtering Keyboard Input
        4. 17.5.4. Keyboard Shortcuts with a Keymap
      6. 17.6. The onload Event
      7. 17.7. Synthetic Events
    6. 18. Forms and Form Elements
      1. 18.1. The Form Object
      2. 18.2. Defining Form Elements
      3. 18.3. Scripting Form Elements
        1. 18.3.1. Naming Forms and Form Elements
        2. 18.3.2. Form Element Properties
        3. 18.3.3. Form Element Event Handlers
        4. 18.3.4. Push Buttons
        5. 18.3.5. Toggle Buttons
        6. 18.3.6. Text Fields
        7. 18.3.7. Select and Option Elements
        8. 18.3.8. Hidden Elements
        9. 18.3.9. Fieldset Elements
      4. 18.4. Form Verification Example
    7. 19. Cookies and Client-Side Persistence
      1. 19.1. An Overview of Cookies
      2. 19.2. Storing Cookies
        1. 19.2.1. Cookie Limitations
      3. 19.3. Reading Cookies
      4. 19.4. Cookie Example
      5. 19.5. Cookie Alternatives
        1. 19.5.1. IE userData Persistence
          1. 19.5.1.1. Storing hierarchical data
          2. 19.5.1.2. Storage limits
          3. 19.5.1.3. Sharing persistent data
        2. 19.5.2. Flash SharedObject Persistence
          1. 19.5.2.1. Storage limits
          2. 19.5.2.2. Persistent data sharing
        3. 19.5.3. Example: Persistent Objects
          1. 19.5.3.1. ActionScript code for Flash persistence
      6. 19.6. Persistent Data and Security
    8. 20. Scripting HTTP
      1. 20.1. Using XMLHttpRequest
        1. 20.1.1. Obtaining a Request Object
        2. 20.1.2. Submitting a Request
        3. 20.1.3. Obtaining a Synchronous Response
        4. 20.1.4. Handling an Asynchronous Response
          1. 20.1.4.1. Notes on readyState 3
        5. 20.1.5. XMLHttpRequest Security
      2. 20.2. XMLHttpRequest Examples and Utilities
        1. 20.1.6. Basic GET Utilities
        2. 20.1.7. Getting Headers Only
        3. 20.1.8. HTTP POST
        4. 20.1.9. HTML, XML, and JSON-Encoded Responses
        5. 20.1.10. Timing Out a Request
      3. 20.3. Ajax and Dynamic Scripting
        1. 20.1.11. Ajax Example
        2. 20.1.12. Single-Page Applications
        3. 20.1.13. Remote Scripting
        4. 20.1.14. Ajax Cautions
      4. 20.4. Scripting HTTP with <script> Tags
    9. 21. JavaScript and XML
      1. 21.1. Obtaining XML Documents
        1. 21.1.1. Creating a New Document
        2. 21.1.2. Loading a Document from the Network
        3. 21.1.3. Parsing XML Text
        4. 21.1.4. XML Documents from Data Islands
      2. 21.2. Manipulating XML with the DOM API
        1. 21.2.1. XML Versus HTML DOM
        2. 21.2.2. Example: Creating an HTML Table from XML Data
      3. 21.3. Transforming XML with XSLT
      4. 21.4. Querying XML with XPath
        1. 21.4.1. XPath Examples
        2. 21.4.2. Evaluating XPath Expressions
        3. 21.4.3. More on the W3C XPath API
      5. 21.5. Serializing XML
      6. 21.6. Expanding HTML Templates with XML Data
      7. 21.7. XML and Web Services
      8. 21.8. E4X: ECMAScript for XML
    10. 22. Scripted Client-Side Graphics
      1. 22.1. Scripting Images
        1. 22.1.1. Images and the Level 0 DOM
        2. 22.1.2. Traditional Image Rollovers
        3. 22.1.3. Offscreen Images and Caching
        4. 22.1.4. Unobtrusive Image Rollovers
        5. 22.1.5. Image Animations
        6. 22.1.6. Other Image Properties
      2. 22.2. Graphics with CSS
        1. 22.2.1. Bar Charts with CSS
        2. 22.2.2. A CSSDrawing Class
      3. 22.3. SVG: Scalable Vector Graphics
      4. 22.4. VML: Vector Markup Language
      5. 22.5. Graphics in a <canvas>
      6. 22.6. Graphics with Flash
      7. 22.7. Graphics with Java
        1. 22.7.1. Pie Charts with Java
        2. 22.7.2. Client-Side Sparkline Images with Java
    11. 23. Scripting Java Applets and Flash Movies
      1. 23.1. Scripting Applets
      2. 23.2. Scripting the Java Plug-in
      3. 23.3. Scripting with Java
        1. 23.3.1. Compiling and Deploying Applets That Use JSObject
        2. 23.3.2. Java-to-JavaScript Data Conversion
        3. 23.3.3. The Common DOM API
      4. 23.4. Scripting Flash
        1. 23.4.1. Embedding and Accessing Flash Movies
        2. 23.4.2. Controlling the Flash Player
        3. 23.4.3. Scripting Flash Movies
        4. 23.4.4. Calling JavaScript from Flash
        5. 23.4.5. Example: Flash to JavaScript, and Back to Flash
      5. 23.5. Scripting Flash 8
  7. III. Core JavaScript Reference
    1. 24. Core JavaScript Reference
      1. Sample Entry: how to read these reference pages — Availability: Inherits from
      2. arguments[ ]: an array of function arguments — ECMAScript v1
      3. Arguments: arguments and other properties of a function — ECMAScript v1: Object → Arguments
      4. Arguments.callee: the function that is currently running — ECMAScript v1
      5. Arguments.length: the number of arguments passed to a function — ECMAScript v1
      6. Array: built-in support for arrays — ECMAScript v1: Object → Array
      7. Array.concat( ): concatenate arrays — ECMAScript v3
      8. Array.join( ): concatenate array elements to form a string — ECMAScript v1
      9. Array.length: the size of an array — ECMAScript v1
      10. Array.pop( ): remove and return the last element of an array — ECMAScript v3
      11. Array.push( ): append elements to an array — ECMAScript v3
      12. Array.reverse( ): reverse the elements of an array — ECMAScript v1
      13. Array.shift( ): shift array elements down — ECMAScript v3
      14. Array.slice( ): return a portion of an array — ECMAScript v3
      15. Array.sort( ): sort the elements of an array — ECMAScript v1
      16. Array.splice( ): insert, remove, or replace array elements — ECMAScript v3
      17. Array.toLocaleString( ): convert an array to a localized string — ECMAScript v1: Overrides Object.toLocaleString( )
      18. Array.toString( ): convert an array to a string — ECMAScript v1: Overrides Object.toString( )
      19. Array.unshift( ): insert elements at the beginning of an array — ECMAScript v3
      20. Boolean: support for boolean values — ECMAScript v1: Object → Boolean
      21. Boolean.toString( ): convert a boolean value to a string — ECMAScript v1: Overrides Object.toString( )
      22. Boolean.valueOf( ): the boolean value of a Boolean object — ECMAScript v1: Overrides Object.valueOf( )
      23. Date: manipulate dates and times — ECMAScript v1: Object → Date
      24. Date.getDate( ): return the day-of-the-month field of a Date — ECMAScript v1
      25. Date.getDay( ): return the day-of-the-week field of a Date — ECMAScript v1
      26. Date.getFullYear( ): return the year field of a Date — ECMAScript v1
      27. Date.getHours( ): return the hours field of a Date — ECMAScript v1
      28. Date.getMilliseconds( ): return the milliseconds field of a Date — ECMAScript v1
      29. Date.getMinutes( ): return the minutes field of a Date — ECMAScript v1
      30. Date.getMonth( ): return the month field of a Date — ECMAScript v1
      31. Date.getSeconds( ): return the seconds field of a Date — ECMAScript v1
      32. Date.getTime( ): return a Date in milliseconds — ECMAScript v1
      33. Date.getTimezoneOffset( ): determine the offset from GMT — ECMAScript v1
      34. Date.getUTCDate( ): return the day-of-the-month field of a Date (universal time) — ECMAScript v1
      35. Date.getUTCDay( ): return the day-of-the-week field of a Date (universal time) — ECMAScript v1
      36. Date.getUTCFullYear( ): return the year field of a Date (universal time) — ECMAScript v1
      37. Date.getUTCHours( ): return the hours field of a Date (universal time) — ECMAScript v1
      38. Date.getUTCMilliseconds( ): return the milliseconds field of a Date (universal time) — ECMAScript v1
      39. Date.getUTCMinutes( ): return the minutes field of a Date (universal time) — ECMAScript v1
      40. Date.getUTCMonth( ): return the month-of-the-year field of a Date (universal time) — ECMAScript v1
      41. Date.getUTCSeconds( ): return the seconds field of a Date (universal time) — ECMAScript v1
      42. Date.getYear( ): return the year field of a Date — ECMAScript v1; deprecated by ECMAScript v3
      43. Date.parse( ): parse a date/time string — ECMAScript v1
      44. Date.setDate( ): set the day-of-the-month field of a Date — ECMAScript v1
      45. Date.setFullYear( ): set the year and, optionally, the month and date fields of a Date — ECMAScript v1
      46. Date.setHours( ): set the hours, minutes, seconds, and milliseconds fields of a Date — ECMAScript v1
      47. Date.setMilliseconds( ): set the milliseconds field of a Date — ECMAScript v1
      48. Date.setMinutes( ): set the minutes, seconds, and milliseconds fields of a Date — ECMAScript v1
      49. Date.setMonth( ): set the month and day fields of a Date — ECMAScript v1
      50. Date.setSeconds( ): set the seconds and milliseconds fields of a Date — ECMAScript v1
      51. Date.setTime( ): set a Date in milliseconds — ECMAScript v1
      52. Date.setUTCDate( ): set the day-of-the-month field of a Date (universal time) — ECMAScript v1
      53. Date.setUTCFullYear( ): set the year, month, and day fields of a Date (universal time) — ECMAScript v1
      54. Date.setUTCHours( ): set the hours, minutes, seconds, and milliseconds fields of a Date (universal time) — ECMAScript v1
      55. Date.setUTCMilliseconds( ): set the milliseconds field of a Date (universal time) — ECMAScript v1
      56. Date.setUTCMinutes( ): set the minutes, seconds, and milliseconds fields of a Date (universal time) — ECMAScript v1
      57. Date.setUTCMonth( ): set the month and day fields of a Date (universal time) — ECMAScript v1
      58. Date.setUTCSeconds( ): set the seconds and milliseconds fields of a Date (universal time) — ECMAScript v1
      59. Date.setYear( ): set the year field of a Date — ECMAScript v1; deprecated by ECMAScript v3
      60. Date.toDateString( ): return the date portion of a Date as a string — ECMAScript v3
      61. Date.toGMTString( ): convert a Date to a universal time string — ECMAScript v1; deprecated by ECMAScript v3
      62. Date.toLocaleDateString( ): return the date portion of a Date as a locally formatted string — ECMAScript v3
      63. Date.toLocaleString( ): convert a Date to a locally formatted string — ECMAScript v1
      64. Date.toLocaleTimeString( ): return the time portion of a Date as a locally formatted string — ECMAScript v3
      65. Date.toString( ): convert a Date to a string — ECMAScript v1: Overrides Object.toString( )
      66. Date.toTimeString( ): return the time portion of a Date as a string — ECMAScript v3
      67. Date.toUTCString( ): convert a Date to a string (universal time) — ECMAScript v1
      68. Date.UTC( ): convert a Date specification to milliseconds — ECMAScript v1
      69. Date.valueOf( ): convert a Date to millisecond representation — ECMAScript v1: Overrides Object.valueOf( )
      70. decodeURI( ): unescape characters in a URI — ECMAScript v3
      71. decodeURIComponent( ): unescape characters in a URI component — ECMAScript v3
      72. encodeURI( ): escape characters in a URI — ECMAScript v3
      73. encodeURIComponent( ): escape characters in a URI component — ECMAScript v3
      74. Error: a generic exception — ECMAScript v3: Object → Error
      75. Error.message: a human-readable error message — ECMAScript v3
      76. Error.name: the type of an error — ECMAScript v3
      77. Error.toString( ): convert an Error object to a string — ECMAScript v3: Overrides Object.toString( )
      78. escape( ): encode a string — ECMAScript v1; deprecated in ECMAScript v3
      79. eval( ): execute JavaScript code from a string — ECMAScript v1
      80. EvalError: thrown when eval( ) is used improperly — ECMAScript v3: Object → Error → EvalError
      81. Function: a JavaScript function — ECMAScript v1: Object → Function
      82. Function.apply( ): invoke a function as a method of an object — ECMAScript v3
      83. Function.arguments[]: arguments passed to a function — ECMAScript v1; deprecated by ECMAScript v3
      84. Function.call( ): invoke a function as a method of an object — ECMAScript v3
      85. Function.caller: the function that called this one — JavaScript 1.0; deprecated by ECMAScript
      86. Function.length: the number of declared arguments — ECMAScript v1
      87. Function.prototype: the prototype for a class of objects — ECMAScript v1
      88. Function.toString( ): convert a function to a string — ECMAScript v1
      89. getClass( ): return the JavaClass of a JavaObject — LiveConnect
      90. Global: the global object — ECMAScript v1: Object → Global
      91. Infinity: a numeric property that represents infinity — ECMAScript v1
      92. isFinite( ): determine whether a number is finite — ECMAScript v1
      93. isNaN( ): check for not-a-number — ECMAScript v1
      94. java: the JavaPackage for the java.* package hierarchy — LiveConnect
      95. JavaArray: JavaScript representation of a Java array — LiveConnect
      96. JavaClass: JavaScript representation of a Java class — LiveConnect
      97. JavaObject: JavaScript representation of a Java object — LiveConnect
      98. JavaPackage: JavaScript representation of a Java package — LiveConnect
      99. JSObject: see JSObject in Part IV
      100. Math: mathematical functions and constants — ECMAScript v1
      101. Math.abs( ): compute an absolute value — ECMAScript v1
      102. Math.acos( ): compute an arccosine — ECMAScript v1
      103. Math.asin( ): compute an arcsine — ECMAScript v1
      104. Math.atan( ): compute an arctangent — ECMAScript v1
      105. Math.atan2( ): compute the angle from the X axis to a point — ECMAScript v1
      106. Math.ceil( ): round a number up — ECMAScript v1
      107. Math.cos( ): compute a cosine — ECMAScript v1
      108. Math.E: the mathematical constant ‘e’ — ECMAScript v1
      109. Math.exp( ): compute ‘e’x — ECMAScript v1
      110. Math.floor( ): round a number down — ECMAScript v1
      111. Math.LN10: the mathematical constant loge2 — ECMAScript v1
      112. Math.LN2: the mathematical constant loge10 — ECMAScript v1
      113. Math.log( ): compute a natural logarithm — ECMAScript v1
      114. Math.LOG10E: the mathematical constant log2 e — ECMAScript v1
      115. Math.LOG2E: the mathematical constant log10 e — ECMAScript v1
      116. Math.max( ): return the largest argument — ECMAScript v1; enhanced in ECMAScript v3
      117. Math.min( ): return the smallest argument — ECMAScript v1; enhanced in ECMAScript v3
      118. Math.PI: the mathematical constant π — ECMAScript v1
      119. Math.pow( ): compute ‘x’y — ECMAScript v1
      120. Math.random( ): return a pseudorandom number — ECMAScript v1
      121. Math.round( ): round to the nearest integer — ECMAScript v1
      122. Math.sin( ): compute a sine — ECMAScript v1
      123. Math.sqrt( ): compute a square root — ECMAScript v1
      124. Math.SQRT1_2: the mathematical constant 1/␁ — ECMAScript v1
      125. Math.SQRT2: the mathematical constant ␁ — ECMAScript v1
      126. Math.tan( ): compute a tangent — ECMAScript v1
      127. NaN: the not-a-number property — ECMAScript v1
      128. Number: support for numbers — ECMAScript v1: Object → Number
      129. Number.MAX_VALUE: the maximum numeric value — ECMAScript v1
      130. Number.MIN_VALUE: the minimum numeric value — ECMAScript v1
      131. Number.NaN: the special not-a-number value — ECMAScript v1
      132. Number.NEGATIVE_INFINITY: negative infinity — ECMAScript v1
      133. Number.POSITIVE_INFINITY: infinity — ECMAScript v1
      134. Number.toExponential( ): format a number using exponential notation — ECMAScript v3
      135. Number.toFixed( ): format a number using fixed-point notation — ECMAScript v3
      136. Number.toLocaleString( ): convert a number to a locally formatted string — ECMAScript v3
      137. Number.toPrecision( ): format the significant digits of a number — ECMAScript v3
      138. Number.toString( ): convert a number to a string — ECMAScript v1: Overrides Object.toString( )
      139. Number.valueOf( ): return the primitive number value — ECMAScript v1: Overrides Object.valueOf( )
      140. Object: a superclass that contains features of all JavaScript objects — ECMAScript v1
      141. Object.constructor: an object’s constructor function — ECMAScript v1
      142. Object.hasOwnProperty( ): check whether a property is inherited — ECMAScript v3
      143. Object.isPrototypeOf( ): is one object the prototype of another? — ECMAScript v3
      144. Object.propertyIsEnumerable( ): will property be seen by a for/in loop? — ECMAScript v3
      145. Object.toLocaleString( ): return an object’s localized string representation — ECMAScript v3
      146. Object.toString( ): define an object’s string representation — ECMAScript v1
      147. Object.valueOf( ): the primitive value of the specified object — ECMAScript v1
      148. Packages: the root JavaPackage — LiveConnect
      149. parseFloat( ): convert a string to a number — ECMAScript v1
      150. parseInt( ): convert a string to an integer — ECMAScript v1
      151. RangeError: thrown when a number is out of its legal range — ECMAScript v3: Object → Error → RangeError
      152. ReferenceError: thrown when reading a variable that does not exist — ECMAScript v3: Object → Error → ReferenceError
      153. RegExp: regular expressions for pattern matching — ECMAScript v3: Object → RegExp
      154. RegExp.exec( ): general-purpose pattern matching — ECMAScript v3
      155. RegExp.global: whether a regular expression matches globally — ECMAScript v3
      156. RegExp.ignoreCase: whether a regular expression is case-insensitive — ECMAScript v3
      157. RegExp.lastIndex: the starting position of the next match — ECMAScript v3
      158. RegExp.source: the text of the regular expression — ECMAScript v3
      159. RegExp.test( ): test whether a string matches a pattern — ECMAScript v3
      160. RegExp.toString( ): convert a regular expression to a string — ECMAScript v3: Overrides Object.toString( )
      161. String: support for strings — ECMAScript v1: Object → String
      162. String.charAt( ): get the ‘n’th character from a string — ECMAScript v1
      163. String.charCodeAt( ): get the ‘n’th character code from a string — ECMAScript v1
      164. String.concat( ): concatenate strings — ECMAScript v3
      165. String.fromCharCode( ): create a string from character encodings — ECMAScript v1
      166. String.indexOf( ): search a string — ECMAScript v1
      167. String.lastIndexOf( ): search a string backward — ECMAScript v1
      168. String.length: the length of a string — ECMAScript v1
      169. String.localeCompare( ): compare one string to another, using locale-specific ordering — ECMAScript v3
      170. String.match( ): find one or more regular-expression matches — ECMAScript v3
      171. String.replace( ): replace substring(s) matching a regular expression — ECMAScript v3
      172. String.search( ): search for a regular expression — ECMAScript v3
      173. String.slice( ): extract a substring — ECMAScript v3
      174. String.split( ): break a string into an array of strings — ECMAScript v3
      175. String.substr( ): extract a substring — JavaScript 1.2; deprecated
      176. String.substring( ): return a substring of a string — ECMAScript v1
      177. String.toLocaleLowerCase( ): convert a string to lowercase — ECMAScript v3
      178. String.toLocaleUpperCase( ): convert a string to uppercase — ECMAScript v3
      179. String.toLowerCase( ): convert a string to lowercase — ECMAScript v1
      180. String.toString( ): return the string — ECMAScript v1: Overrides Object.toString( )
      181. String.toUpperCase( ): convert a string to uppercase — ECMAScript v1
      182. String.valueOf( ): return the string — ECMAScript v1: Overrides Object.valueOf( )
      183. SyntaxError: thrown to signal a syntax error — ECMAScript v3: Object → Error → SyntaxError
      184. TypeError: thrown when a value is of the wrong type — ECMAScript v3: Object → Error → TypeError
      185. undefined: the undefined value — ECMAScript v3
      186. unescape( ): decode an escaped string — ECMAScript v1; deprecated in ECMAScript v3
      187. URIError: thrown by URI encoding and decoding methods — ECMAScript v3: Object → Error → URIError
  8. IV. Client-Side JavaScript Reference
    1. 25. Client-Side JavaScript Reference
      1. Anchor: the target of a hypertext link — DOM Level 0: Node → Element → HTMLElement → Anchor
      2. Anchor.focus( ): scroll to make the anchor location visible — DOM Level 0:
      3. Applet: an applet embedded in a web page — DOM Level 0:
      4. Attr: an attribute of a document element — DOM Level 1 Core: Node → Attr
      5. Button: see Input
      6. Canvas: an HTML element for scripted drawing — Firefox 1.5, Safari 1.3, Opera 9: Node → Element → HTMLElement → Canvas
      7. Canvas.getContext( ): return a context for drawing on the canvas
      8. CanvasGradient: a color gradient for use in a canvas — Firefox 1.5, Safari 1.3, Opera 9: Object → CanvasGradient
      9. CanvasGradient.addColorStop( ): add a change of color at some point in the gradient
      10. CanvasPattern: an image-based pattern for use in a Canvas — Firefox 1.5, Safari 1.3, Opera 9: Object → CanvasPattern
      11. CanvasRenderingContext2D: the object used for drawing on a canvas — Firefox 1.5, Safari 1.3, Opera 9: Object → CanvasRenderingContext2D
      12. CanvasRenderingContext2D.arc( ): add an arc to the current subpath of a canvas, using a center point and radius
      13. CanvasRenderingContext2D.arcTo( ): add an arc of a circle to the current subpath, using tangent points and a radius
      14. CanvasRenderingContext2D.beginPath( ): start a new collection of subpaths in a canvas
      15. CanvasRenderingContext2D.bezierCurveTo( ): add a cubic Bézier curve to the current subpath
      16. CanvasRenderingContext2D.clearRect( ): erase a rectangular area of a canvas
      17. CanvasRenderingContext2D.clip( ): set the clipping path of a canvas
      18. CanvasRenderingContext2D.closePath( ): closes an open subpath
      19. CanvasRenderingContext2D.createLinearGradient( ): create a linear color gradient
      20. CanvasRenderingContext2D.createPattern( ): create a pattern of tiled images
      21. CanvasRenderingContext2D.createRadialGradient( ): create a radial color gradient
      22. CanvasRenderingContext2D.drawImage( ): draw an image
      23. CanvasRenderingContext2D.fill( ): fill the path
      24. CanvasRenderingContext2D.fillRect( ): fill a rectangle
      25. CanvasRenderingContext2D.globalCompositeOperation: specifies how colors are combined on the canvas
      26. CanvasRenderingContext2D.lineCap: specifies how the ends of lines are rendered
      27. CanvasRenderingContext2D.lineJoin: specifies how vertices are rendered
      28. CanvasRenderingContext2D.lineTo( ): add a straight line to the current subpath
      29. CanvasRenderingContext2D.miterLimit: maximum-miter-length-to-line-width ratio
      30. CanvasRenderingContext2D.moveTo( ): sets the current position and begins a new subpath
      31. CanvasRenderingContext2D.quadraticCurveTo( ): add a quadratic Bezier curve to the current subpath
      32. CanvasRenderingContext2D.rect( ): add a rectangle subpath to the path
      33. CanvasRenderingContext2D.restore( ): reset drawing state to saved values
      34. CanvasRenderingContext2D.rotate( ): rotate the coordinate system of the canvas
      35. CanvasRenderingContext2D.save( ): save a copy of the current graphics state
      36. CanvasRenderingContext2D.scale( ): scale the user coordinate system of the canvas
      37. CanvasRenderingContext2D.stroke( ): draw the current path
      38. CanvasRenderingContext2D.strokeRect( ): draw a rectangle
      39. CanvasRenderingContext2D.translate( ): translate the user coordinate system of the canvas
      40. CDATASection: a CDATA node in an XML document — DOM Level 1 XML: Node → CharacterData → Text → CDATASection
      41. CharacterData: common functionality for Text and Comment nodes — DOM Level 1 Core: Node → CharacterData
      42. CharacterData.appendData( ): append a string to a Text or Comment node — DOM Level 1 Core:
      43. CharacterData.deleteData( ): delete characters from a Text or Comment node — DOM Level 1 Core:
      44. CharacterData.insertData( ): insert a string into a Text or Comment node — DOM Level 1 Core:
      45. CharacterData.replaceData( ): replace characters of a Text or Comment node with a string — DOM Level 1 Core:
      46. CharacterData.substringData( ): extract a substring from a Text or Comment node — DOM Level 1 Core:
      47. Checkbox: see Input
      48. Comment: an HTML or XML comment — DOM Level 1 Core: Node → CharacterData → Comment
      49. CSS2Properties: a set of CSS attributes and their values — DOM Level 2 CSS2: Object → CSS2Properties
      50. CSSRule: a rule in a CSS stylesheet — DOM Level 2 CSS, IE 5: Object → CSSRule
      51. CSSStyleSheet: a CSS stylesheet — DOM Level 2 CSS, IE 4: Object → CSSStyleSheet
      52. CSSStyleSheet.addRule( ): IE-specific method to insert a rule into a stylesheet — IE 4:
      53. CSSStyleSheet.deleteRule( ): delete a rule from a stylesheet — DOM Level 2 CSS:
      54. CSSStyleSheet.insertRule( ): insert a rule into a stylesheet — DOM Level 2 CSS:
      55. CSSStyleSheet.removeRule( ): IE-specific method to remove a rule from a stylesheet — IE 4:
      56. Document: an HTML or XML document — DOM Level 1 Core: Node → Document
      57. Document.addEventListener( ): see Element.addEventListener( )
      58. Document.attachEvent( ): see Element.attachEvent( )
      59. Document.createAttribute( ): create a new Attr node — DOM Level 1 Core:
      60. Document.createAttributeNS( ): create an Attr with a name and namespace — DOM Level 2 Core:
      61. Document.createCDATASection( ): create a new CDATASection node — DOM Level 1 Core:
      62. Document.createComment( ): create a new Comment node — DOM Level 1 Core:
      63. Document.createDocumentFragment( ): create a new, empty DocumentFragment node — DOM Level 1 Core:
      64. Document.createElement( ): create a new Element node — DOM Level 1 Core:
      65. Document.createElementNS( ): create a new Element node using a namespace — DOM Level 2 Core:
      66. Document.createEvent( ): create an Event object — DOM Level 2 Events:
      67. Document.createExpression( ): create an XPath expression for later evaluation — Firefox 1.0, Safari 2.01, Opera 9:
      68. Document.createProcessingInstruction( ): create a ProcessingInstruction node — DOM Level 1 Core:
      69. Document.createRange( ): create a Range object — DOM Level 2 Range:
      70. Document.createTextNode( ): create a new Text node — DOM Level 1 Core:
      71. Document.detachEvent( ): see Element.detachEvent( )
      72. Document.dispatchEvent( ): see Element.dispatchEvent( )
      73. Document.evaluate( ): evaluate an XPath expression — Firefox 1.0, Safari 2.01, Opera 9:
      74. Document.getElementById( ): find an element with the specified unique ID — DOM Level 2 Core:
      75. Document.getElementsByTagName( ): return all Element nodes with the specified name — DOM Level 1 Core:
      76. Document.getElementsByTagNameNS( ): return all Element nodes with a specified name and namespace — DOM Level 2 Core:
      77. Document.importNode( ): copy a node from another document for use in this document — DOM Level 2 Core:
      78. Document.loadXML( ): populate this Document by parsing a string of XML markup — Internet Explorer:
      79. Document.removeEventListener( ): see Element.removeEventListener( )
      80. DocumentFragment: adjacent nodes and their subtrees — DOM Level 1 Core: Node → DocumentFragment
      81. DocumentType: the DTD of an XML document — DOM Level 1 XML: Node → DocumentType
      82. DOMException: signal exceptions or errors for core DOM objects — DOM Level 1 Core: Object → DOMException
      83. DOMImplementation: methods independent of any particular document — DOM Level 1 Core: Object → DOMImplementation
      84. DOMImplementation.createDocument( ): create a new Document and the specified root element — DOM Level 2 Core:
      85. DOMImplementation.createDocumentType( ): create a DocumentType node — DOM Level 2 Core:
      86. DOMImplementation.hasFeature( ): determine whether the implementation supports a feature — DOM Level 1 Core:
      87. DOMParser: parses XML markup to create a Document — Firefox 1.0, Safari 2.01, Opera 7.60: Object → DOMParser
      88. DOMParser.parseFromString( ): parse XML markup
      89. Element: an HTML or XML element — DOM Level 1 Core: Node → Element
      90. Element.addEventListener( ): register an event handler — DOM Level 2 Events:
      91. Element.attachEvent( ): register an event handler — IE 4:
      92. Element.detachEvent( ): delete an event listener — IE 4:
      93. Element.dispatchEvent( ): dispatch a synthetic event to this node — DOM Level 2 Events:
      94. Element.getAttribute( ): return the string value of a named attribute — DOM Level 1 Core:
      95. Element.getAttributeNode( ): return the Attr node for the named attribute — DOM Level 1 Core:
      96. Element.getAttributeNodeNS( ): return the Attr node for an attribute with a namespace — DOM Level 2 Core:
      97. Element.getAttributeNS( ): get the value of an attribute that uses namespaces — DOM Level 2 Core:
      98. Element.getElementsByTagName( ): find descendant elements with a specified tag name — DOM Level 1 Core:
      99. Element.getElementsByTagNameNS( ): return descendant elements with the specified name and namespace — DOM Level 2 Core:
      100. Element.hasAttribute( ): determine whether this element has a specified attribute — DOM Level 2 Core:
      101. Element.hasAttributeNS( ): determine whether this element has a specified attribute — DOM Level 2 Core:
      102. Element.removeAttribute( ): delete a named attribute of an element — DOM Level 1 Core:
      103. Element.removeAttributeNode( ): remove an Attr node from an element — DOM Level 1 Core:
      104. Element.removeAttributeNS( ): delete an attribute specified by name and namespace — DOM Level 2 Core:
      105. Element.removeEventListener( ): delete an event listener — DOM Level 2 Events:
      106. Element.setAttribute( ): create or change an attribute of an element — DOM Level 1 Core:
      107. Element.setAttributeNode( ): add a new Attr node to an Element — DOM Level 1 Core:
      108. Element.setAttributeNodeNS( ): add a namespace Attr node to an Element — DOM Level 2 Core:
      109. Element.setAttributeNS( ): create or change an attribute with a namespace — DOM Level 2 Core:
      110. Event: information about an event — DOM Level 2 Events, IE: Object → Event
      111. Event.initEvent( ): initialize the properties of a new event — DOM Level 2 Events
      112. Event.preventDefault( ): cancel default action of an event — DOM Level 2 Events
      113. Event.stopPropagation( ): do not dispatch an event any further — DOM Level 2 Events
      114. ExternalInterface: a bidirectional interface to Flash — ActionScript Object in Flash 8
      115. ExternalInterface.addCallback( ): expose an ActionScript method for execution from JavaScript — ActionScript function in Flash 8
      116. ExternalInterface.call( ): call a JavaScript function from ActionScript — ActionScript function in Flash 8
      117. FileUpload: see Input
      118. FlashPlayer: plug-in for Flash movies — Flash 2.0
      119. FlashPlayer.GetVariable( ): return a value defined in a Flash movie — Flash 4
      120. FlashPlayer.GotoFrame( ): skip to the specified frame of a movie — Flash 2
      121. FlashPlayer.IsPlaying( ): check whether a movie is playing — Flash 2
      122. FlashPlayer.LoadMovie( ): load an auxiliary movie — Flash 3
      123. FlashPlayer.Pan( ): move the viewport of the movie — Flash 2
      124. FlashPlayer.PercentLoaded( ): determine how much of the movie has loaded — Flash 2
      125. FlashPlayer.Play( ): play a movie — Flash 2
      126. FlashPlayer.Rewind( ): rewind the movie to its first frame — Flash 2
      127. FlashPlayer.SetVariable( ): set a variable defined by a Flash movie — Flash 4
      128. FlashPlayer.SetZoomRect( ): set the viewport of a movie — Flash 2
      129. FlashPlayer.StopPlay( ): stop the movie — Flash 2
      130. FlashPlayer.TotalFrames( ): return the length of the movie, in frames — Flash 2
      131. FlashPlayer.Zoom( ): zoom in or out — Flash 2
      132. Form: a <form> in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → Form
      133. Form.elements[]: the input elements of a form — DOM Level 2 HTML
      134. Form.onreset: event handler invoked when a form is reset — DOM Level 0
      135. Form.onsubmit: event handler invoked when a form is submitted — DOM Level 0
      136. Form.reset( ): reset the elements of a form to their default values — DOM Level 2 HTML
      137. Form.submit( ): submit form data to a web server — DOM Level 2 HTML
      138. Frame: a <frame> in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → Frame
      139. Hidden: see Input
      140. History: the URL history of the browser — JavaScript 1.0: Object → History
      141. History.back( ): return to the previous URL — JavaScript 1.0
      142. History.forward( ): visit the next URL — JavaScript 1.0
      143. History.go( ): revisit a URL — JavaScript 1.0
      144. HTMLCollection: array of HTML elements accessible by position or name — DOM Level 2 HTML: Object → HTMLCollection
      145. HTMLCollection.item( ): get an element by position — DOM Level 2 HTML
      146. HTMLCollection.namedItem( ): get an element by name — DOM Level 2 HTML
      147. HTMLDocument: the root of an HTML document tree — DOM Level 0: Node → Document → HTMLDocument
      148. HTMLDocument.all[]: all HTML elements in a document — IE 4
      149. HTMLDocument.close( ): close an open document and display it — DOM Level 0
      150. HTMLDocument.cookie: the cookie(s) of the document — DOM Level 0
      151. HTMLDocument.domain: the security domain of a document — DOM Level 0
      152. HTMLDocument.getElementsByName( ): find elements with the specified name attribute — DOM Level 2 HTML
      153. HTMLDocument.open( ): begin a new document, erasing the current one — DOM Level 0
      154. HTMLDocument.write( ): append HTML text to an open document — DOM Level 0
      155. HTMLDocument.writeln( ): append HTML text and a newline to an open document — DOM Level 0
      156. HTMLElement: an element in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement
      157. HTMLElement.onclick: event handler invoked when the user clicks on an element — DOM Level 0
      158. HTMLElement.ondblclick: event handler invoked when the user double-clicks on an element — DOM Level 0
      159. HTMLElement.onkeydown: event handler invoked when the user presses a key — DOM Level 0
      160. HTMLElement.onkeypress: event handler invoked when the user presses a key — DOM Level 0
      161. HTMLElement.onkeyup: event handler invoked when the user releases a key — DOM Level 0
      162. HTMLElement.onmousedown: event handler invoked when the user presses a mouse button — DOM Level 0
      163. HTMLElement.onmousemove: event handler invoked when the mouse moves within an element — DOM Level 0
      164. HTMLElement.onmouseout: event handler invoked when mouse moves out of an element — DOM Level 0
      165. HTMLElement.onmouseover: event handler invoked when the mouse moves over an element — DOM Level 0
      166. HTMLElement.onmouseup: event handler invoked when the user releases a mouse button — DOM Level 0
      167. HTMLElement.scrollIntoView( ): make an element visible — Firefox 1.0, IE 4, Safari 2.02, Opera 8.5
      168. IFrame: an <iframe> in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → IFrame
      169. Image: an image in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → Image
      170. Image.onabort: event handler invoked when the user aborts image loading — DOM Level 2 Events
      171. Image.onerror: event handler invoked when an error occurs during image loading — DOM Level 2 Events
      172. Image.onload: event handler invoked when an image finishes loading — DOM Level 2 Events
      173. Input: an input element in an HTML form — DOM Level 2 HTML: Node → Element → HTMLElement → Input
      174. Input.blur( ): remove keyboard focus from a form element — DOM Level 2 HTML
      175. Input.click( ): simulate a mouse click on a form element — DOM Level 2 HTML
      176. Input.focus( ): give keyboard focus to a form element — DOM Level 2 HTML
      177. Input.onblur: the handler invoked when a form element loses focus — DOM Level 0
      178. Input.onchange: event handler invoked when a form element’s value changes — DOM Level 2 Events
      179. Input.onclick: event handler invoked when a form element is clicked — DOM Level 2 Events
      180. Input.onfocus: event handler invoked when a form element gains focus — DOM Level 2 Events
      181. Input.select( ): select the text in a form element — DOM Level 2 HTML
      182. JavaArray, JavaClass, JavaObject, JavaPackage: see Part III
      183. JSObject: Java representation of a JavaScript object — Java class in Java plug-in
      184. JSObject.call( ): invoke a method of a JavaScript object — Java method in Java plug-in
      185. JSObject.eval( ): evaluate a string of JavaScript code — Java method in Java plug-in
      186. JSObject.getMember( ): read a property of a JavaScript object — Java method in Java plug-in
      187. JSObject.getSlot( ): read an array element of a JavaScript object — Java method in Java plug-in
      188. JSObject.getWindow( ): return initial JSObject for browser window — Java method in Java plug-in
      189. JSObject.removeMember( ): delete a property of a JavaScript object — Java method in Java plug-in
      190. JSObject.setMember( ): set a property of a JavaScript object — Java method in Java plug-in
      191. JSObject.setSlot( ): set an array element of a JavaScript object — Java method in Java plug-in
      192. JSObject.toString( ): return the string value of a JavaScript object — Java method in Java plug-in
      193. KeyEvent: details about a keyboard event — Firefox and compatible browsers: Event → UIEvent → KeyEvent
      194. Layer: an obsolete Netscape API — Netscape 4 only; discontinued in Netscape 6
      195. Link: a hyperlink or anchor in an HTML document — DOM Level 0: Node → Element → HTMLElement → Link
      196. Link.blur( ): take keyboard focus away from a hyperlink — DOM Level 0
      197. Link.focus( ): make a link visible and give it keyboard focus — DOM Level 0
      198. Link.onclick: event handler invoked when a Link is clicked — DOM Level 0
      199. Link.onmouseout: event handler invoked when the mouse leaves a link — DOM Level 0
      200. Link.onmouseover: event handler invoked when the mouse goes over a link — DOM Level 0
      201. Location: represents and controls browser location — JavaScript 1.0: Object → Location
      202. Location.reload( ): reload the current document — JavaScript 1.1
      203. Location.replace( ): replace one displayed document with another — JavaScript 1.1
      204. MimeType: represents a MIME datatype — JavaScript 1.1; not supported by IE: Object → MimeType
      205. MouseEvent: details about a mouse event — DOM Level 2 Events: Event → UIEvent → MouseEvent
      206. MouseEvent.initMouseEvent( ): initialize the properties of a MouseEvent object — DOM Level 2 Events
      207. Navigator: information about the browser in use — JavaScript 1.0: Object → Navigator
      208. Navigator.javaEnabled( ): test whether Java is available — JavaScript 1.1
      209. Node: a node in a document tree — DOM Level 1 Core
      210. Node.appendChild( ): insert a node as the last child of this node — DOM Level 1 Core
      211. Node.cloneNode( ): duplicate a node and, optionally, all of its descendants — DOM Level 1 Core
      212. Node.hasAttributes( ): determine whether a node has attributes — DOM Level 2 Core
      213. Node.hasChildNodes( ): determine whether a node has children — DOM Level 1 Core
      214. Node.insertBefore( ): insert a node into the document tree before the specified node — DOM Level 1 Core
      215. Node.isSupported( ): determine if a node supports a feature — DOM Level 2 Core
      216. Node.normalize( ): merge adjacent Text nodes and remove empty ones — DOM Level 1 Core
      217. Node.removeChild( ): remove (and return) the specified child of this node — DOM Level 1 Core
      218. Node.replaceChild( ): replace a child node with a new node — DOM Level 1 Core
      219. Node.selectNodes( ): select nodes with an XPath query — IE 6
      220. Node.transformNode( ): transform a node to a string using XSLT — IE 6
      221. Node.transformNodeToObject( ): transform a node to a document using XSLT — IE 6
      222. NodeList: a read-only array of nodes — DOM Level 1 Core: Object → NodeList
      223. NodeList.item(): get an element of a NodeList — DOM Level 1 Core
      224. Option: an option in a Select element — DOM Level 2 HTML: Node → Element → HTMLElement → HTMLOptionElement
      225. Packages: see Packages in Part III
      226. Password: see Input
      227. Plugin: describes an installed plug-in — JavaScript 1.1; not supported by IE: Object → Plugin
      228. ProcessingInstruction : a processing instruction in an XML document — DOM Level 1 XML: Node → ProcessingInstruction
      229. Radio: see Input
      230. Range: represents a contiguous range of a document — DOM Level 2 Range: Object → Range
      231. Range.cloneContents(): copy range contents into a DocumentFragment — DOM Level 2 Range
      232. Range.cloneRange(): make a copy of this range — DOM Level 2 Range
      233. Range.collapse(): make one boundary point equal to the other — DOM Level 2 Range
      234. Range.compareBoundaryPoints(): compare positions of two ranges — DOM Level 2 Range
      235. Range.deleteContents(): delete a region of the document — DOM Level 2 Range
      236. Range.detach(): free a Range object — DOM Level 2 Range
      237. Range.extractContents( ): delete document content and return it in a DocumentFragment — DOM Level 2 Range
      238. Range.insertNode( ): insert a node at the start of a range — DOM Level 2 Range
      239. Range.selectNode(): set range boundaries to a node — DOM Level 2 Range
      240. Range.selectNodeContents( ): set range boundaries to the children of a node — DOM Level 2 Range
      241. Range.setEnd( ): set the end point of a range — DOM Level 2 Range
      242. Range.setEndAfter( ): end a range after a specified node — DOM Level 2 Range
      243. Range.setEndBefore( ): end a range before the specified node — DOM Level 2 Range
      244. Range.setStart( ): set the start point of a range — DOM Level 2 Range
      245. Range.setStartAfter( ): start a range after the specified node — DOM Level 2 Range
      246. Range.setStartBefore( ): start a range before the specified node — DOM Level 2 Range
      247. Range.surroundContents( ): surround range contents with the specified node — DOM Level 2 Range
      248. Range.toString( ): get range contents as a plain-text string — DOM Level 2 Range
      249. RangeException: signals a range-specific exception — DOM Level 2 Range: Object → RangeException
      250. Reset: see Input
      251. Screen: provides information about the display — JavaScript 1.2: Object → Screen
      252. Select: a graphical selection list — DOM Level 2 HTML: Node → Element → HTMLElement → Select
      253. Select.add( ): insert an <option> element — DOM Level 2 HTML
      254. Select.blur( ): take keyboard focus away from this element — DOM Level 2 HTML
      255. Select.focus( ): give keyboard focus to this element — DOM Level 2 HTML
      256. Select.onchange: event handler invoked when the selection changes — DOM Level 0
      257. Select.options[]: the choices in a Select object — DOM Level 2 HTML
      258. Select.remove( ): remove an <option> — DOM Level 2 HTML
      259. Style: see CSS2Properties
      260. Submit: see Input
      261. Table: a <table> in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement → Table
      262. Table.createCaption( ): get or create a <caption> — DOM Level 2 HTML
      263. Table.createTFoot( ): get or create a <tfoot> — DOM Level 2 HTML
      264. Table.createTHead( ): get or create a <thead> — DOM Level 2 HTML
      265. Table.deleteCaption( ): delete the <caption> of a table — DOM Level 2 HTML
      266. Table.deleteRow( ): delete a row of a table — DOM Level 2 HTML
      267. Table.deleteTFoot( ): delete the <tfoot> of a table — DOM Level 2 HTML
      268. Table.deleteTHead( ): delete the <thead> of a table — DOM Level 2 HTML
      269. Table.insertRow( ): add a new, empty row to the table — DOM Level 2 HTML
      270. TableCell: cell in an HTML table — DOM Level 2 HTML: Node → Element → HTMLElement → TableCell
      271. TableRow: a <tr> element in an HTML table — DOM Level 2 HTML: Node → Element → HTMLElement → TableRow
      272. TableRow.deleteCell( ): delete a cell in a table row — DOM Level 2 HTML
      273. TableRow.insertCell( ): insert a new, empty <td> element into a table row — DOM Level 2 HTML
      274. TableSection: a header, footer, or body section of a table — DOM Level 2 HTML: Node → Element → HTMLElement → TableSection
      275. TableSection.deleteRow( ): delete a row within a table section — DOM Level 2 HTML
      276. TableSection.insertRow( ): insert a new, empty row into this table section — DOM Level 2 HTML
      277. Text: a run of text in an HTML or XML document — DOM Level 1 Core: Node → CharacterData → Text
      278. Text.splitText( ): split a Text node in two — DOM Level 1 Core
      279. Textarea: a multiline text input area — DOM Level 2 HTML: Node → Element → HTMLElement → Textarea
      280. Textarea.blur( ): take keyboard focus away from this element — DOM Level 2 HTML
      281. Textarea.focus( ): give keyboard focus to this element — DOM Level 2 HTML
      282. Textarea.onchange: event handler invoked when input value changes — DOM Level 0
      283. Textarea.select( ): select the text in this element — DOM Level 2 HTML
      284. TextField: see Input
      285. UIEvent: details about user-interface events — DOM Level 2 Events: Event → UIEvent
      286. UIEvent.initUIEvent( ): initialize the properties of a UIEvent object — DOM Level 2 Events
      287. Window: a web browser window or frame — JavaScript 1.0: Object → Global → Window
      288. Window.addEventListener( ): see Element.addEventListener( )
      289. Window.alert( ): display a message in a dialog box — JavaScript 1.0:
      290. Window.attachEvent( ): see Element.attachEvent( )
      291. Window.blur( ): remove keyboard focus from a top-level window — JavaScript 1.1:
      292. Window.clearInterval( ): stop periodically executing code — JavaScript 1.2:
      293. Window.clearTimeout( ): cancel deferred execution — JavaScript 1.0:
      294. Window.close( ): close a browser window — JavaScript 1.0:
      295. Window.confirm( ): ask a yes-or-no question — JavaScript 1.0:
      296. Window.defaultStatus: the default status line text — JavaScript 1.0:
      297. Window.detachEvent( ): see Element.detachEvent( )
      298. Window.focus( ): give keyboard focus to a window — JavaScript 1.1:
      299. Window.getComputedStyle( ): retrieve the CSS styles used to render an element — DOM Level 2 CSS:
      300. Window.moveBy( ): move a window to a relative position — JavaScript 1.2:
      301. Window.moveTo( ): move a window to an absolute position — JavaScript 1.2:
      302. Window.onblur: event handler invoked when the window loses keyboard focus — JavaScript 1.1:
      303. Window.onerror: error handler invoked when a JavaScript error occurs — JavaScript 1.1:
      304. Window.onfocus: event handler invoked when a window is given focus — JavaScript 1.1:
      305. Window.onload: event handler invoked when a document finishes loading — JavaScript 1.0:
      306. Window.onresize: event handler invoked when a window is resized — JavaScript 1.2:
      307. Window.onunload: the handler invoked when the browser leaves a page — DOM Level 0:
      308. Window.open( ): open a new browser window or locate a named window — JavaScript 1.0:
      309. Window.print( ): print the document — JavaScript 1.5:
      310. Window.prompt( ): get user input with a dialog box — JavaScript 1.0:
      311. Window.removeEventListener( ): see Element.removeEventListener( )
      312. Window.resizeBy( ): resize a window by a relative amount — JavaScript 1.2:
      313. Window.resizeTo( ): resize a window — JavaScript 1.2:
      314. Window.scrollBy( ): scroll the document by a relative amount — JavaScript 1.2:
      315. Window.scrollTo( ): scroll the document — JavaScript 1.2:
      316. Window.setInterval( ): periodically execute specified code — JavaScript 1.2:
      317. Window.setTimeout( ): defer execution of code — JavaScript 1.0:
      318. Window.status: specify a transient status-line message — JavaScript 1.0:
      319. XMLHttpRequest: An HTTP request and response — Firefox 1.0, Internet Explorer 5.0, Safari 1.2, Opera 7.60: Object → XMLHttpRequest
      320. XMLHttpRequest.abort( ): cancel an HTTP request
      321. XMLHttpRequest.getAllResponseHeaders( ): return unparsed HTTP response headers
      322. XMLHttpRequest.getResponseHeader( ): get the value of a named HTTP response header
      323. XMLHttpRequest.onreadystatechange: event handler function invoked when readyState changes
      324. XMLHttpRequest.open( ): initialize HTTP request parameters
      325. XMLHttpRequest.send( ): send an HTTP request
      326. XMLHttpRequest.setRequestHeader( ): add a HTTP request header to the request
      327. XMLSerializer: serializes XML documents and nodes — Firefox 1.0, Safari 2.01, Opera 7.60: Object → XMLSerializer
      328. XMLSerializer.serializeToString( ): convert an XML document or node to a string
      329. XPathExpression: a compiled XPath query — Firefox 1.0, Safari 2.01, Opera 9: Object → XPathExpression
      330. XPathExpression.evaluate( ): evaluate a compiled XPath query
      331. XPathResult: the result of an XPath query — Firefox 1.0; Safari 2.01; Opera 9: Object → XPathResult
      332. XPathResult.iterateNext( ): return the next node that matches an XPath query
      333. XPathResult.snapshotItem( ): return a node that matches an XPath query
      334. XSLTProcessor: transform XML with XSLT stylesheets — Firefox 1.0, Safari 2.01, Opera 9: Object → XSLTProcessor
      335. XSLTProcessor.clearParameters( ): delete all stylesheet parameter values
      336. XSLTProcessor.getParameter( ): return the value of a named parameter
      337. XSLTProcessor.importStylesheet( ): specify an XSLT stylesheet for transformations
      338. XSLTProcessor.removeParameter( ): delete a parameter value
      339. XSLTProcessor.reset( ): restore an XSLTProcessor to its default state
      340. XSLTProcessor.setParameter( ): set a stylesheet parameter
      341. XSLTProcessor.transformToDocument( ): transform a node or document to a new document
      342. XSLTProcessor.transformToFragment( ): transform a node or document to a DocumentFragment
  9. About the Author
  10. Colophon
  11. Copyright

Product information

  • Title: JavaScript: The Definitive Guide, 5th Edition
  • Author(s): David Flanagan
  • Release date: August 2006
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596101992