| Preface | p. xvii |
| Who Should Read this Book? | p. xviii |
| What's Covered in this Book? | p. xviii |
| The Book's Web Site | p. xx |
| The Code Archive | p. xx |
| Updates and Errata | p. xx |
| The SitePoint Forums | p. xxi |
| The SitePoint Newsletters | p. xxi |
| Your Feedback | p. xxi |
| Acknowledgments | p. xxi |
| Kevin Yank | p. xxi |
| Cameron Adams | p. xxii |
| Conventions Used in this Book | p. xxiii |
| Code Samples | p. xxiii |
| Tips, Notes, and Warnings | p. xxiv |
| The Three Layers of the Web | p. 1 |
| Keep 'em Separated | p. 2 |
| Three Layers | p. 4 |
| HTML for Content | p. 6 |
| CSS for Presentation | p. 8 |
| JavaScript for Behavior | p. 9 |
| The Right Way | p. 11 |
| JavaScript Libraries | p. 11 |
| Let's Get Started! | p. 12 |
| Programming with JavaScript | p. 13 |
| Running a JavaScript Program | p. 14 |
| Statements: Bite-sized Chunks for your Browser | p. 17 |
| Comments: Bite-sized Chunks Just for You | p. 18 |
| Variables: Storing Data for your Program | p. 19 |
| Variable Types: Different Types for Different Data | p. 23 |
| Conditions and Loops: Controlling Program Flow | p. 35 |
| Conditions: Making Decisions | p. 36 |
| Loops: Minimizing Repetition | p. 43 |
| Functions: Writing Code for Later | p. 48 |
| Arguments: Passing Data to a Function | p. 50 |
| Return Statements: Outputting Data from a Function | p. 52 |
| Scope: Keeping your Variables Separate | p. 54 |
| Objects | p. 55 |
| Unobtrusive Scripting in the Real World | p. 58 |
| Summary | p. 59 |
| Document Access | p. 61 |
| The Document Object Model: Mapping your HTML | p. 61 |
| Text Nodes | p. 64 |
| Attribute Nodes | p. 65 |
| Accessing the Nodes you Want | p. 66 |
| Finding an Element by ID | p. 67 |
| Finding Elements by Tag Name | p. 70 |
| Finding Elements by Class Name | p. 74 |
| Navigating the DOM Tree | p. 79 |
| Interacting with Attributes | p. 82 |
| Changing Styles | p. 85 |
| Changing Styles with Class | p. 87 |
| Example: Making Stripy Tables | p. 92 |
| Finding All Tables with Class dataTable | p. 93 |
| Getting the Table Rows for Each Table | p. 94 |
| Adding the Class alt to Every Second Row | p. 96 |
| Putting it All Together | p. 96 |
| Exploring Libraries | p. 99 |
| Prototype | p. 99 |
| jQuery | p. 100 |
| Dojo | p. 102 |
| Summary | p. 102 |
| Events | p. 105 |
| An Eventful History | p. 106 |
| Event Handlers | p. 107 |
| Default Actions | p. 111 |
| The this Keyword | p. 112 |
| The Problem with Event Handlers | p. 115 |
| Event Listeners | p. 116 |
| Default Actions | p. 119 |
| Event Propagation | p. 122 |
| The this Keyword | p. 127 |
| The Internet Explorer Memory Leak | p. 128 |
| Putting it All Together | p. 129 |
| Example: Rich Tooltips | p. 132 |
| The Static Page | p. 133 |
| Making Things Happen | p. 134 |
| The Workhorse Methods | p. 135 |
| The Dynamic Styles | p. 140 |
| Putting it All Together | p. 142 |
| Example: Accordion | p. 144 |
| The Static Page | p. 144 |
| The Workhorse Methods | p. 146 |
| The Dynamic Styles | p. 148 |
| Putting it All Together | p. 150 |
| Exploring Libraries | p. 158 |
| Summary | p. 160 |
| Animation | p. 163 |
| The Principles of Animation | p. 163 |
| Controlling Time with JavaScript | p. 165 |
| Using Variables with setTimeout | p. 168 |
| Stopping the Timer | p. 172 |
| Creating a Repeating Timer | p. 174 |
| Stopping setInterval | p. 175 |
| Revisiting Rich Tooltips | p. 175 |
| Old-school Animation in a New-school Style | p. 176 |
| Path-based Motion | p. 181 |
| Animating in Two Dimensions | p. 190 |
| Creating Realistic Movement | p. 192 |
| Moving Ahead | p. 198 |
| Revisiting the Accordion Control | p. 198 |
| Making the Accordion Look Like it's Animated | p. 198 |
| Changing the Code | p. 199 |
| Exploring Libraries | p. 208 |
| script.aculo.us | p. 208 |
| Summary | p. 211 |
| Form Enhancements | p. 213 |
| HTML DOM Extensions | p. 214 |
| Example: Dependent Fields | p. 216 |
| Example: Cascading Menus | p. 226 |
| Form Validation | p. 239 |
| Intercepting Form Submissions | p. 240 |
| Regular Expressions | p. 243 |
| Example: Reusable Validation Script | p. 249 |
| Custom Form Controls | p. 256 |
| Example: Slider | p. 256 |
| Exploring Libraries | p. 271 |
| Form Validation | p. 272 |
| Custom Controls | p. 274 |
| Summary | p. 275 |
| Errors and Debugging | p. 277 |
| Nothing Happened! | p. 278 |
| Common Errors | p. 282 |
| Syntax Errors | p. 283 |
| Runtime Errors | p. 288 |
| Logic Errors | p. 292 |
| Debugging with Firebug | p. 296 |
| Summary | p. 303 |
| Ajax | p. 305 |
| XMLHttpRequest: Chewing Bite-sized Chunks of Content | p. 306 |
| Creating an XMLHttpRequest Object | p. 307 |
| Calling a Server | p. 310 |
| Dealing with Data | p. 314 |
| A Word on Screen Readers | p. 316 |
| Putting Ajax into Action | p. 316 |
| Seamless Form Submission with Ajax | p. 329 |
| Exploring Libraries | p. 337 |
| Prototype | p. 339 |
| Dojo | p. 340 |
| jQuery | p. 341 |
| YUI | p. 341 |
| MooTools | p. 342 |
| Summary | p. 343 |
| Looking Forward | p. 345 |
| Bringing Richness to the Web | p. 346 |
| Easy Exploration | p. 346 |
| Easy Visualization | p. 347 |
| Unique Interaction | p. 349 |
| Rich Internet Applications | p. 352 |
| Widgets | p. 355 |
| JavaScript Off the Web | p. 356 |
| Exploring Libraries | p. 357 |
| Dojo | p. 358 |
| Google Web Toolkit | p. 361 |
| Summary | p. 362 |
| The Core JavaScript Library | p. 363 |
| The Object | p. 363 |
| Event Listener Methods | p. 364 |
| Script Bootstrapping | p. 375 |
| CSS Class Management Methods | p. 378 |
| Retrieving Computed Styles | p. 379 |
| The Complete Library | p. 379 |
| Index | p. 387 |
| Table of Contents provided by Ingram. All Rights Reserved. |