Books & Videos

Table of Contents

  1. Chapter 1 Strings

    1. Introduction

    2. Concatenating (Joining) Strings

    3. Improving String Handling Performance

    4. Accessing Substrings

    5. Changing String Case

    6. Testing Equality of Two Strings

    7. Testing String Containment Without Regular Expressions

    8. Testing String Containment with Regular Expressions

    9. Searching and Replacing Substrings

    10. Using Special and Escaped Characters

    11. Reading and Writing Strings for Cookies

    12. Converting Between Unicode Values and String Characters

    13. Encoding and Decoding URL Strings

    14. Encoding and Decoding Base64 Strings

  2. Chapter 2 Numbers and Dates

    1. Introduction

    2. Converting Between Numbers and Strings

    3. Testing a Number's Validity

    4. Testing Numeric Equality

    5. Rounding Floating-Point Numbers

    6. Formatting Numbers for Text Display

    7. Converting Between Decimal and Hexadecimal Numbers

    8. Generating Pseudorandom Numbers

    9. Calculating Trigonometric Functions

    10. Creating a Date Object

    11. Calculating a Previous or Future Date

    12. Calculating the Number of Days Between Two Dates

    13. Validating a Date

  3. Chapter 3 Arrays and Objects

    1. Introduction

    2. Creating a Simple Array

    3. Creating a Multidimensional Array

    4. Converting Between Arrays and Strings

    5. Doing Something with the Items in an Array

    6. Sorting a Simple Array

    7. Combining Arrays

    8. Dividing Arrays

    9. Creating a Custom Object

    10. Simulating a Hash Table for Fast Array Lookup

    11. Doing Something with a Property of an Object

    12. Sorting an Array of Objects

    13. Customizing an Object's Prototype

    14. Converting Arrays and Custom Objects to Strings

    15. Using Objects to Reduce Naming Conflicts

  4. Chapter 4 Variables, Functions, and Flow Control

    1. Introduction

    2. Creating a JavaScript Variable

    3. Creating a Named Function

    4. Nesting Named Functions

    5. Creating an Anonymous Function

    6. Delaying a Function Call

    7. Branching Execution Based on Conditions

    8. Handling Script Errors Gracefully

    9. Improving Script Performance

  5. Chapter 5 Browser Feature Detection

    1. Introduction

    2. Detecting the Browser Brand

    3. Detecting an Early Browser Version

    4. Detecting the Internet Explorer Version

    5. Detecting the Mozilla Version

    6. Detecting the Safari Version

    7. Detecting the Opera Version

    8. Detecting the Client Operating System

    9. Detecting Object Support

    10. Detecting Object Property and Method Support

    11. Detecting W3C DOM Standard Support

    12. Detecting the Browser Written Language

    13. Detecting Cookie Availability

    14. Defining Browser- or Feature-Specific Links

    15. Testing on Multiple Browser Versions

  6. Chapter 6 Managing Browser Windows

    1. Introduction

    2. Living with Browser Window Control Limitations

    3. Setting the Main Window's Size

    4. Positioning the Main Window

    5. Maximizing the Main Window

    6. Creating a New Window

    7. Bringing a Window to the Front

    8. Communicating with a New Window

    9. Communicating Back to the Main Window

    10. Using Internet Explorer Modal/Modeless Windows

    11. Simulating a Cross-Browser Modal Dialog Window

    12. Simulating a Window with Layers

  7. Chapter 7 Managing Multiple Frames

    1. Introduction

    2. Creating a Blank Frame in a New Frameset

    3. Changing the Content of One Frame from Another

    4. Changing the Content of Multiple Frames at Once

    5. Replacing a Frameset with a Single Page

    6. Avoiding Being "Framed" by Another Site

    7. Ensuring a Page Loads in Its Frameset

    8. Reading a Frame's Dimensions

    9. Resizing Frames

    10. Setting Frameset Specifications Dynamically

  8. Chapter 8 Dynamic Forms

    1. Introduction

    2. Auto-Focusing the First Text Field

    3. Performing Common Text Field Validations

    4. Preventing Form Submission upon Validation Failure

    5. Auto-Focusing an Invalid Text Field Entry

    6. Using a Custom Validation Object

    7. Changing a Form's Action

    8. Blocking Submissions from the Enter Key

    9. Advancing Text Field Focus with the Enter Key

    10. Submitting a Form by an Enter Key Press in Any Text Box

    11. Disabling Form Controls

    12. Hiding and Showing Form Controls

    13. Allowing Only Numbers (or Letters) in a Text Box

    14. Auto-Tabbing for Fixed-Length Text Boxes

    15. Changing select Element Content

    16. Copying Form Data Between Pages

  9. Chapter 9 Managing Events

    1. Introduction

    2. Equalizing the IE and W3C Event Models

    3. Initiating a Process After the Page Loads

    4. Appending Multiple Load Event Handlers

    5. Determining the Coordinates of a Click Event

    6. Preventing an Event from Performing Its Default Behavior

    7. Blocking Duplicate Clicks

    8. Determining Which Element Received an Event

    9. Determining Which Mouse Button Was Pressed

    10. Reading Which Character Key Was Typed

    11. Reading Which Noncharacter Key Was Pressed

    12. Determining Which Modifier Keys Were Pressed During an Event

    13. Determining the Element the Cursor Rolled From/To

    14. Synchronizing Sounds to Events

  10. Chapter 10 Page Navigation Techniques

    1. Introduction

    2. Loading a New Page or Anchor

    3. Keeping a Page Out of the Browser History

    4. Using a select Element for Navigation

    5. Passing Data Between Pages via Cookies

    6. Passing Data Between Pages via Frames

    7. Passing Data Between Pages via URLs

    8. Creating a Contextual (Right-Click) Menu

    9. Creating Drop-Down Navigation Menus

    10. Providing Navigation Trail Menus

    11. Creating Expandable Menus

    12. Creating Collapsible XML Menus

  11. Chapter 11 Managing Style Sheets

    1. Introduction

    2. Assigning Style Sheet Rules to an Element Globally

    3. Assigning Style Sheet Rules to a Subgroup of Elements

    4. Assigning Style Sheet Rules to an Individual Element

    5. Importing External Style Sheets

    6. Importing Browser-or Operating System-Specific Style Sheets

    7. Changing Imported Style Sheets After Loading

    8. Enabling/Disabling Style Sheets

    9. Toggling Between Style Sheets for an Element

    10. Overriding a Style Sheet Rule

    11. Turning Arbitrary Content into a Styled Element

    12. Creating Center-Aligned Body Elements

    13. Reading Effective Style Sheet Property Values

    14. Forcing Recent Browsers into Standards-Compatibility Mode

  12. Chapter 12 Visual Effects for Stationary Content

    1. Introduction

    2. Precaching Images

    3. Swapping Images (Rollovers)

    4. Reducing Rollover Image Downloads with JavaScript

    5. Reducing Rollover Image Downloads with CSS

    6. Dynamically Changing Image Sizes

    7. Changing Text Style Properties

    8. Offering Body Text Size Choices to Users

    9. Creating Custom Link Styles

    10. Changing Page Background Colors and Images

    11. Hiding and Showing Elements

    12. Adjusting Element Transparency

    13. Creating Transition Visual Effects

    14. Drawing Charts in the Canvas Element

  13. Chapter 13 Positioning HTML Elements

    1. Introduction

    2. Making an Element Positionable in the Document Space

    3. Connecting a Positioned Element to a Body Element

    4. Controlling Positioning via a DHTML JavaScript Library

    5. Deciding Between div and span Containers

    6. Adjusting Positioned Element Stacking Order (Z-order)

    7. Centering an Element on Top of Another Element

    8. Centering an Element in a Window or Frame

    9. Determining the Location of a Nonpositioned Element

    10. Animating Straight-Line Element Paths

    11. Animating Circular Element Paths

    12. Creating a Draggable Element

    13. Scrolling div Content

    14. Creating a Custom Scrollbar

    15. Creating a Slider Control

  14. Chapter 14 Creating Dynamic Content

    1. Introduction

    2. Writing Dynamic Content During Page Loading

    3. Creating New Page Content Dynamically

    4. Including External HTML Content

    5. Embedding XML Data

    6. Embedding Data As JavaScript Objects

    7. Transforming XML Data into HTML Tables

    8. Transforming JavaScript Objects into HTML Tables

    9. Converting an XML Node Tree to JavaScript Objects

    10. Creating a New HTML Element

    11. Creating Text Content for a New Element

    12. Creating Mixed Element and Text Nodes

    13. Inserting and Populating an iframe Element

    14. Getting a Reference to an HTML Element Object

    15. Referencing All Elements of the Same Class

    16. Replacing Portions of Body Content

    17. Removing Body Content

    18. Using XMLHttpRequest for a REST Request

    19. Using XMLHttpRequest for a SOAP Call

    20. Sorting Dynamic Tables

    21. Walking the Document Node Tree

    22. Capturing Document Content

  15. Chapter 15 Dynamic Content Applications

    1. Introduction

    2. Displaying a Random Aphorism

    3. Converting a User Selection into an Arbitrary Element

    4. Automating the Search-and-Replace of Body Content

    5. Designing a User-Editable Content Page

    6. Creating a Slide Show

    7. Auto-Scrolling the Page

    8. Greeting Users with Their Time of Day

    9. Displaying the Number of Days Before Christmas

    10. Displaying a Countdown Timer

    11. Creating a Calendar Date Picker

    12. Displaying an Animated Progress Bar

  1. Appendix A Keyboard Event Character Values

  2. Appendix B Keyboard Key Code Values

  3. Appendix C ECMAScript Reserved Keywords

  4. Colophon