Wednesday, September 22, 2010

JavaScript And DHTML Cookbook












By Danny Goodman

Publisher : O'Reilly
Pub Date : April 2003
ISBN : 0-596-00467-2
Pages : 540


On numerous online forums for JavaScript and DHTML, the majority of questions begin with "How do I...?" This new Cookbook provides the answers with a comprehensive collection of problems, solutions, and practical examples. The book's recipes range from simple tasks, such as manipulating strings and validating dates in JavaScript, to entire libraries that demonstrate complex tasks, such as cross-browser positioning of HTML elements and sorting tables.

Copyright
Preface
About You
About the Recipes
What's in This Book
Browser Platforms
Conventions Used in This Book
Request for Comments
Acknowledgments

Chapter 1. Strings
Section 1.0. Introduction
Section 1.1. Concatenating (Joining) Strings
Section 1.2. Accessing Substrings
Section 1.3. Changing String Case
Section 1.4. Testing Equality of Two Strings
Section 1.5. Testing String Containment Without Regular Expressions
Section 1.6. Testing String Containment with Regular Expressions
Section 1.7. Searching and Replacing Substrings
Section 1.8. Using Special and Escaped Characters
Section 1.9. Reading and Writing Strings for Cookies
Section 1.10. Converting Between Unicode Values and String Characters
Section 1.11. Encoding and Decoding URL Strings
Section 1.12. Encoding and Decoding Base64 Strings

Chapter 2. Numbers and Dates
Section 2.0. Introduction
Section 2.1. Converting Between Numbers and Strings
Section 2.2. Testing a Number's Validity
Section 2.3. Testing Numeric Equality
Section 2.4. Rounding Floating-Point Numbers
Section 2.5. Formatting Numbers for Text Display
Section 2.6. Converting Between Decimal and Hexadecimal Numbers
Section 2.7. Generating Pseudorandom Numbers
Section 2.8. Calculating Trigonometric Functions
Section 2.9. Creating a Date Object
Section 2.10. Calculating a Previous or Future Date
Section 2.11. Calculating the Number of Days Between Two Dates
Section 2.12. Validating a Date

Chapter 3. Arrays and Objects
Section 3.0. Introduction
Section 3.1. Creating a Simple Array
Section 3.2. Creating a Multidimensional Array
Section 3.3. Converting Between Arrays and Strings
Section 3.4. Doing Something with the Items in an Array
Section 3.5. Sorting a Simple Array
Section 3.6. Combining Arrays
Section 3.7. Dividing Arrays
Section 3.8. Creating a Custom Object
Section 3.9. Simulating a Hash Table for Fast Array Lookup
Section 3.10. Doing Something with a Property of an Object
Section 3.11. Sorting an Array of Objects
Section 3.12. Customizing an Object's Prototype
Section 3.13. Converting Arrays and Custom Objects to Strings

Chapter 4. Variables, Functions, and Flow Control
Section 4.0. Introduction
Section 4.1. Creating a JavaScript Variable
Section 4.2. Creating a Named Function
Section 4.3. Nesting Named Functions
Section 4.4. Creating an Anonymous Function
Section 4.5. Delaying a Function Call
Section 4.6. Branching Execution Based on Conditions
Section 4.7. Handling Script Errors Gracefully
Section 4.8. Improving Script Performance

Chapter 5. Browser Feature Detection
Section 5.0. Introduction
Section 5.1. Detecting the Browser Brand
Section 5.2. Detecting an Early Browser Version
Section 5.3. Detecting the Internet Explorer Version
Section 5.4. Detecting the Netscape Navigator Version
Section 5.5. Detecting the Client Operating System
Section 5.6. Detecting Object Support
Section 5.7. Detecting Object Property and Method Support
Section 5.8. Detecting the Browser Written Language
Section 5.9. Detecting Cookie Availability
Section 5.10. Defining Browser- or Feature-Specific Links
Section 5.11. Testing on Multiple Browser Versions

Chapter 6. Managing Browser Windows
Section 6.0. Introduction
Section 6.1. Setting the Main Window's Size
Section 6.2. Positioning the Main Window
Section 6.3. Maximizing the Main Window
Section 6.4. Creating a New Window
Section 6.5. Bringing a Window to the Front
Section 6.6. Communicating with a New Window
Section 6.7. Communicating Back to the Main Window
Section 6.8. Using Internet Explorer Modal/Modeless Windows
Section 6.9. Simulating a Cross-Browser Modal Dialog Window
Section 6.10. Simulating a Window with Layers

Chapter 7. Managing Multiple Frames
Section 7.0. Introduction
Section 7.1. Creating a Blank Frame in a New Frameset
Section 7.2. Changing the Content of One Frame from Another
Section 7.3. Changing the Content of Multiple Frames at Once
Section 7.4. Replacing a Frameset with a Single Page
Section 7.5. Avoiding Being "Framed" by Another Site
Section 7.6. Assuring a Page Loads in its Frameset
Section 7.7. Reading a Frame's Dimensions
Section 7.8. Resizing Frames
Section 7.9. Setting Frameset Specifications Dynamically

Chapter 8. Dynamic Forms
Section 8.0. Introduction
Section 8.1. Auto-Focusing the First Text Field
Section 8.2. Performing Common Text Field Validations
Section 8.3. Preventing Form Submission upon Validation Failure
Section 8.4. Auto-Focusing an Invalid Text Field Entry
Section 8.5. Changing a Form's Action
Section 8.6. Blocking Submissions from the Enter Key
Section 8.7. Advancing Text Field Focus with the Enter Key
Section 8.8. Submitting a Form by an Enter Key Press in Any Text Box
Section 8.9. Disabling Form Controls
Section 8.10. Hiding and Showing Form Controls
Section 8.11. Allowing Only Numbers (or Letters) in a Text Box
Section 8.12. Auto-Tabbing for Fixed-Length Text Boxes
Section 8.13. Changing select Element Content
Section 8.14. Copying Form Data Between Pages

Chapter 9. Managing Events
Section 9.0. Introduction
Section 9.1. Equalizing the IE and W3C Event Models
Section 9.2. Initiating a Process After the Page Loads
Section 9.3. Determining the Coordinates of a Click Event
Section 9.4. Preventing an Event from Performing Its Default Behavior
Section 9.5. Blocking Double Clicks
Section 9.6. Determining Which Element Received an Event
Section 9.7. Determining Which Mouse Button Was Pressed
Section 9.8. Reading Which Character Key Was Typed
Section 9.9. Reading Which Noncharacter Key Was Pressed
Section 9.10. Determining Which Modifier Keys Were Pressed During an Event
Section 9.11. Determining the Element the Cursor Rolled From/To
Section 9.12. Synchronizing Sounds to Events

Chapter 10. Page Navigation Techniques
Section 10.0. Introduction
Section 10.1. Loading a New Page or Anchor
Section 10.2. Keeping a Page Out of the Browser History
Section 10.3. Using a select Element for Navigation
Section 10.4. Passing Data Between Pages Via Cookies
Section 10.5. Passing Data Between Pages Via Frames
Section 10.6. Passing Data Between Pages Via URLs
Section 10.7. Creating a Contextual (Right-Click) Menu
Section 10.8. Creating Drop-Down Navigation Menus
Section 10.9. Providing Navigation Trail Menus
Section 10.10. Creating Expandable Menus
Section 10.11. Creating Collapsible XML Menus

Chapter 11. Managing Style Sheets
Section 11.0. Introduction
Section 11.1. Assigning Style Sheet Rules to an Element Globally
Section 11.2. Assigning Style Sheet Rules to a Subgroup of Elements
Section 11.3. Assigning Style Sheet Rules to an Individual Element
Section 11.4. Impoting External Style Sheets
Section 11.5. Impoting Browser- or Operating System-Specific Style Sheets
Section 11.6. Changing Impoted Style Sheets After Loading
Section 11.7. Enabling/Disabling Style Sheets
Section 11.8. Toggling Between Style Sheets for an Element
Section 11.9. Overriding a Style Sheet Rule
Section 11.10. Turning Arbitrary Content into a Styled Element
Section 11.11. Creating Center-Aligned Body Elements
Section 11.12. Reading Effective Style Sheet Property Values
Section 11.13. Forcing Version 6 Browsers into Standards-Compatibility Mode

Chapter 12. Visual Effects for Stationary Content
Section 12.0. Introduction
Section 12.1. Precaching Images
Section 12.2. Swapping Images (Rollovers)
Section 12.3. Changing Text Style Properties
Section 12.4. Offering Body Text Size Choices to Users
Section 12.5. Creating Custom Link Styles
Section 12.6. Changing Page Background Colors and Images
Section 12.7. Hiding and Showing Elements
Section 12.8. Adjusting Element Transparency
Section 12.9. Creating Transition Visual Effects

Chapter 13. Positioning HTML Elements
Section 13.0. Introduction
Section 13.1. Making an Element Positionable in the Document Space
Section 13.2. Connecting a Positioned Element to a Body Element
Section 13.3. Controlling Positioning Via a DHTML JavaScript Library
Section 13.4. Deciding Between div and span Containers
Section 13.5. Adjusting Positioned Element Stacking Order (z-order)
Section 13.6. Centering an Element on Top of Another Element
Section 13.7. Centering an Element in a Window or Frame
Section 13.8. Determining the Location of a Nonpositioned Element
Section 13.9. Animating Straight-Line Element Paths
Section 13.10. Animating Circular Element Paths
Section 13.11. Creating a Draggable Element
Section 13.12. Scrolling div Content
Section 13.13. Creating a Custom Scrollbar

Chapter 14. Creating Dynamic Content
Section 14.0. Introduction
Section 14.1. Writing Dynamic Content During Page Loading
Section 14.2. Creating New Page Content Dynamically
Section 14.3. Including External HTML Content
Section 14.4. Embedding XML Data
Section 14.5. Embedding Data as JavaScript Objects
Section 14.6. Transforming XML Data into HTML Tables
Section 14.7. Transforming JavaScript Objects into HTML Tables
Section 14.8. Converting an XML Node Tree to JavaScript Objects
Section 14.9. Creating a New Element
Section 14.10. Creating Text Content for a New Element
Section 14.11. Creating Mixed Element and Text Nodes
Section 14.12. Inserting and Populating an iframe Element
Section 14.13. Getting a Reference to an HTML Element Object
Section 14.14. Replacing Portions of Body Content
Section 14.15. Removing Body Content
Section 14.16. Sorting Dynamic Tables
Section 14.17. Walking the Document Node Tree
Section 14.18. Capturing Document Content

Chapter 15. Dynamic Content Applications
Section 15.0. Introduction
Section 15.1. Displaying a Random Aphorism
Section 15.2. Converting a User Selection into an Arbitrary Element
Section 15.3. Automating the Search-and-Replace of Body Content
Section 15.4. Creating a Slide Show
Section 15.5. Auto-Scrolling the Page
Section 15.6. Greeting Users with Their Time of Day
Section 15.7. Displaying the Number of Days Before Christmas
Section 15.8. Displaying a Countdown Timer
Section 15.9. Creating a Calendar Date Picker
Section 15.10. Displaying an Animated Progress Bar

Appendix A. Keyboard Event Character Values
Appendix B. Keyboard Key Code Values
Appendix C. ECMAScript Reserved Keywords
Colophon
Index

Download
Another Web Programming Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!