Stylin’ with CSS

The Blog and Books of Charles Wyke-Smith

Scriptin’ with JavaScript and Ajax–Table of Contents

Codin' cover
  1. Introduction •  xii
  2. Chapter 1 : JavaScript Comes of Age • 2
    1. Accessibility and Progressive Enhancement • 5
    2. Three Steps to Progressive Enhancement • 7
      1. 1. Make It Functional • 8
      2. 2. Make It Look Good • 17
      3. 3. Enhance the Experience with JavaScript and Ajax • 21
    3. Summary  • 23
  3. Chapter 2 : JavaScript Basics • 24
    1. Running the Code Examples • 26
      1. Hello, JavaScript • 27
    2. Scripts, Statements, and Comments • 28
      1. Scripts • 28
      2. Statements • 28
      3. Comments • 29
    3. Data and Ways to Store It • 30
      1. Variables • 30
      2. Strings • 32
      3. Numbers • 34
      4. Booleans • 34
      5. Arrays • 34
    4. Code that Acts on Data • 38
      1. Operators • 38
      2. Loops and Iterating Over Data • 46
      3. Functions • 50
    5. Summary • 55
  4. Chapter 3 : Objects and the DOM • 56
    1. Objects • 58
      1. Predefined JavaScript Objects • 59
      2. User-created Objects • 60
      3. Objects and Instances • 63
    2. DOMinating the Document • 68
      1. Getting Around the DOM • 68
      2. Get, Set…DOM! • 70
      3. Modifying Element Styles • 75
      4. Zebra Tables • 78
      5. Refactoring the Code • 85
    3. Summary • 87
  5. Chapter 4 : Events • 88
    1. Techniques to Handle Events • 90
      1. JavaScript Pseudo Protocol • 90
      2. Inline Event Handler • 91
      3. Handler as Object Property • 93
      4. Event Listeners • 94
    2. The First Event: load • 97
      1. Adding Event Listeners on Page Load • 99
    3. The Event Object • 103
      1. The Event Object’s Type Property • 104
      2. The Event Object in Microsoft Browsers • 105
    4. The Secret Life of Events • 111
      1. Capturing and Bubbling • 112
      2. Event Delegation • 112
    5. Striped Table with Rollovers • 113
      1. Using an Element as a Debugging Tool • 113
      2. Mouse events • 114
      3. Event Delegation • 114
      4. Determining the Target Element • 116
      5. Traversing the DOM • 118
      6. Adding the Highlight • 120
    6. The Up and Down Life of Keys • 122
      1. Text Fields with Character Limits • 123
      2. Setting Up the Message Display • 124
      3. Monitoring the Character Count • 127
      4. The Finished Code • 130
    7. Summary • 131
  6. Chapter 5 : Ajax • 132
    1. Understanding Ajax • 134
      1. Ajax by the Letters • 134
      2. Communication with the Server • 136
      3. The XMLHttpRequest Object • 138
      4. How to Use the XMLHttpRequest (XHR) Object • 139
      5. Using the Ajax Function • 144
      6. Using an Object Literal to Maintain State Through an Ajax Call • 146
      7. Ajax and Data Formats • 149
    2. Creating a Simple Catalog • 149
      1. Using PHP Templates • 150
      2. An Ajax-ready Page • 155
      3. Adding Ajax Functionality to the Catalog • 156
      4. An Accessible Catalog • 161
      5. Working with JSON • 162
      6. The Guitar Catalog Using JSON • 164
      7. Using XML • 167
    3. Using Sajax-the Simple Ajax Framework • 173
    4. Summary • 177
  7. Chapter 6 : Frameworks • 178
    1. About Frameworks  • 180
      1. Advantages of Frameworks • 180
      2. Considerations When Using a Framework • 181
    2. Namespacing • 182
      1. Pseudo-global Variables • 184
      2. Ajax Implementation in Four Frameworks • 186
      3. jQuery Namespace • 186
      4. Prototype • 188
      5. Yahoo! User Interface (YUI) • 189
      6. Adobe Spry • 190
    3. RIA Components • 191
      1. Accordion with jQuery and Spry • 191
      2. Highlight with Prototype and Spry • 195
      3. Drag-and-drop with Prototype and jQuery • 197
      4. Tabs with jQuery and Spry • 200
    4. Summary • 203
  8. Chapter 7 : Two Simple Web Applications • 204
    1. About the Projects • 206
      1. An Image Carousel • 207
      2. A Location Finder with AutoComplete • 208
    2. Building the Author Carousel  • 209
      1. Styling the Carousel • 211
      2. Managing the Scrollbar • 214
      3. The PHP backend • 215
      4. Layering on the JavaScript • 222
      5. Implementing the Carousel Interactions  • 224
      6. Implementing the Overlay • 228
      7. Parsing the JSON with JavaScript • 230
    3. AutoComplete and Maps with the Yahoo! API • 233
      1. The Location Data • 234
      2. The Project Template—index.php • 234
      3. The Search Form Script—searchform.php • 239
      4. Implementing Search Without JavaScript—searchresults.php • 248
    4. Summary • 250
  9. Appendix A • 252
  10. Appendix B • 258
  11. Appendix C • 272
  12. Appendix D • 276
  13. Index • 282
Back to Top