SitemapMain PageTable of contentCopyrightPrefaceAbout YouAbout the RecipesWhat's in This BookBrowser PlatformsConventions Used in This BookRequest for CommentsAcknowledgmentsChapter 1. Strings1.0 Introduction1.1 Concatenating (Joining) Strings1.2 Accessing Substrings1.3 Changing String Case1.4 Testing Equality of Two Strings1.5 Testing String Containment Without Regular Expressions1.6 Testing String Containment with Regular Expressions1.7 Searching and Replacing Substrings1.8 Using Special and Escaped Characters1.9 Reading and Writing Strings for Cookies1.10 Converting Between Unicode Values and String Characters1.11 Encoding and Decoding URL Strings1.12 Encoding and Decoding Base64 StringsChapter 2. Numbers and Dates2.0 Introduction2.1 Converting Between Numbers and Strings2.2 Testing a Number's Validity2.3 Testing Numeric Equality2.4 Rounding Floating-Point Numbers2.5 Formatting Numbers for Text Display2.6 Converting Between Decimal and Hexadecimal Numbers2.7 Generating Pseudorandom Numbers2.8 Calculating Trigonometric Functions2.9 Creating a Date Object2.10 Calculating a Previous or Future Date2.11 Calculating the Number of Days Between Two Dates2.12 Validating a DateChapter 3. Arrays and Objects3.0 Introduction3.1 Creating a Simple Array3.2 Creating a Multidimensional Array3.3 Converting Between Arrays and Strings3.4 Doing Something with the Items in an Array3.5 Sorting a Simple Array3.6 Combining Arrays3.7 Dividing Arrays3.8 Creating a Custom Object3.9 Simulating a Hash Table for Fast Array Lookup3.10 Doing Something with a Property of an Object3.11 Sorting an Array of Objects3.12 Customizing an Object's Prototype3.13 Converting Arrays and Custom Objects to StringsChapter 4. Variables, Functions, and Flow Control4.0 Introduction4.1 Creating a JavaScript Variable4.2 Creating a Named Function4.3 Nesting Named Functions4.4 Creating an Anonymous Function4.5 Delaying a Function Call4.6 Branching Execution Based on Conditions4.7 Handling Script Errors Gracefully4.8 Improving Script PerformanceChapter 5. Browser Feature Detection5.0 Introduction5.1 Detecting the Browser Brand5.2 Detecting an Early Browser Version5.3 Detecting the Internet Explorer Version5.4 Detecting the Netscape Navigator Version5.5 Detecting the Client Operating System5.6 Detecting Object Support5.7 Detecting Object Property and Method Support5.8 Detecting the Browser Written Language5.9 Detecting Cookie Availability5.10 Defining Browser- or Feature-Specific Links5.11 Testing on Multiple Browser VersionsChapter 6. Managing Browser Windows6.0 Introduction6.1 Setting the Main Window's Size6.2 Positioning the Main Window6.3 Maximizing the Main Window6.4 Creating a New Window6.5 Bringing a Window to the Front6.6 Communicating with a New Window6.7 Communicating Back to the Main Window6.8 Using Internet Explorer Modal/Modeless Windows6.9 Simulating a Cross-Browser Modal Dialog Window6.10 Simulating a Window with LayersChapter 7. Managing Multiple Frames7.0 Introduction7.1 Creating a Blank Frame in a New Frameset7.2 Changing the Content of One Frame from Another7.3 Changing the Content of Multiple Frames at Once7.4 Replacing a Frameset with a Single Page7.5 Avoiding Being 'Framed' by Another Site7.6 Assuring a Page Loads in its Frameset7.7 Reading a Frame's Dimensions7.8 Resizing Frames7.9 Setting Frameset Specifications DynamicallyChapter 8. Dynamic Forms8.0 Introduction8.1 Auto-Focusing the First Text Field8.2 Performing Common Text Field Validations8.3 Preventing Form Submission upon Validation Failure8.4 Auto-Focusing an Invalid Text Field Entry8.5 Changing a Form's Action8.6 Blocking Submissions from the Enter Key8.7 Advancing Text Field Focus with the Enter Key8.8 Submitting a Form by an Enter Key Press in Any Text Box8.9 Disabling Form Controls8.10 Hiding and Showing Form Controls8.11 Allowing Only Numbers (or Letters) in a Text Box8.12 Auto-Tabbing for Fixed-Length Text Boxes8.13 Changing select Element Content8.14 Copying Form Data Between PagesChapter 9. Managing Events9.0 Introduction9.1 Equalizing the IE and W3C Event Models9.2 Initiating a Process After the Page Loads9.3 Determining the Coordinates of a Click Event9.4 Preventing an Event from Performing Its Default Behavior9.5 Blocking Double Clicks9.6 Determining Which Element Received an Event9.7 Determining Which Mouse Button Was Pressed9.8 Reading Which Character Key Was Typed9.9 Reading Which Noncharacter Key Was Pressed9.10 Determining Which Modifier Keys Were Pressed During an Event9.11 Determining the Element the Cursor Rolled From/To9.12 Synchronizing Sounds to EventsChapter 10. Page Navigation Techniques10.0 Introduction10.1 Loading a New Page or Anchor10.2 Keeping a Page Out of the Browser History10.3 Using a select Element for Navigation10.4 Passing Data Between Pages Via Cookies10.5 Passing Data Between Pages Via Frames10.6 Passing Data Between Pages Via URLs10.7 Creating a Contextual (Right-Click) Menu10.8 Creating Drop-Down Navigation Menus10.9 Providing Navigation Trail Menus10.10 Creating Expandable Menus10.11 Creating Collapsible XML MenusChapter 11. Managing Style Sheets11.0 Introduction11.1 Assigning Style Sheet Rules to an Element Globally11.2 Assigning Style Sheet Rules to a Subgroup of Elements11.3 Assigning Style Sheet Rules to an Individual Element11.4 Importing External Style Sheets11.5 Importing Browser- or Operating System-Specific Style Sheets11.6 Changing Imported Style Sheets After Loading11.7 Enabling/Disabling Style Sheets11.8 Toggling Between Style Sheets for an Element11.9 Overriding a Style Sheet Rule11.10 Turning Arbitrary Content into a Styled Element11.11 Creating Center-Aligned Body Elements11.12 Reading Effective Style Sheet Property Values11.13 Forcing Version 6 Browsers into Standards-Compatibility ModeChapter 12. Visual Effects for Stationary Content12.0 Introduction12.1 Precaching Images12.2 Swapping Images (Rollovers)12.3 Changing Text Style Properties12.4 Offering Body Text Size Choices to Users12.5 Creating Custom Link Styles12.6 Changing Page Background Colors and Images12.7 Hiding and Showing Elements12.8 Adjusting Element Transparency12.9 Creating Transition Visual EffectsChapter 13. Positioning HTML Elements13.0 Introduction13.1 Making an Element Positionable in the Document Space13.2 Connecting a Positioned Element to a Body Element13.3 Controlling Positioning Via a DHTML JavaScript Library13.4 Deciding Between div and span Containers13.5 Adjusting Positioned Element Stacking Order (z-order)13.6 Centering an Element on Top of Another Element13.7 Centering an Element in a Window or Frame13.8 Determining the Location of a Nonpositioned Element13.9 Animating Straight-Line Element Paths13.10 Animating Circular Element Paths13.11 Creating a Draggable Element13.12 Scrolling div Content13.13 Creating a Custom ScrollbarChapter 14. Creating Dynamic Content14.0 Introduction14.1 Writing Dynamic Content During Page Loading14.2 Creating New Page Content Dynamically14.3 Including External HTML Content14.4 Embedding XML Data14.5 Embedding Data as JavaScript Objects14.6 Transforming XML Data into HTML Tables14.7 Transforming JavaScript Objects into HTML Tables14.8 Converting an XML Node Tree to JavaScript Objects14.9 Creating a New Element14.10 Creating Text Content for a New Element14.11 Creating Mixed Element and Text Nodes14.12 Inserting and Populating an iframe Element14.13 Getting a Reference to an HTML Element Object14.14 Replacing Portions of Body Content14.15 Removing Body Content14.16 Sorting Dynamic Tables14.17 Walking the Document Node Tree14.18 Capturing Document ContentChapter 15. Dynamic Content Applications15.0 Introduction15.1 Displaying a Random Aphorism15.2 Converting a User Selection into an Arbitrary Element15.3 Automating the Search-and-Replace of Body Content15.4 Creating a Slide Show15.5 Auto-Scrolling the Page15.6 Greeting Users with Their Time of Day15.7 Displaying the Number of Days Before Christmas15.8 Displaying a Countdown Timer15.9 Creating a Calendar Date Picker15.10 Displaying an Animated Progress BarAppendix A. Keyboard Event Character ValuesAppendix B. Keyboard Key Code ValuesAppendix C. ECMAScript Reserved KeywordsColophonIndexIndex SYMBOLIndex AIndex BIndex CIndex DIndex EIndex FIndex GIndex HIndex IIndex JIndex KIndex LIndex MIndex NIndex OIndex PIndex QIndex RIndex SIndex TIndex UIndex VIndex WIndex XIndex YIndex Z