Accelerated DOM Scripting with Ajax, APIs, and Libraries

Book description

If you're a web developer with previous JavaScript and DOM scripting experience, Accelerated DOM Scripting with Ajax, APIs, and Libraries is perfect for you to take your knowledge to the next level.

This book is about JavaScript and using the document object model—the conduit to the HTML document. This book is not about learning how to program JavaScript from scratch. It starts with the assumption that you have done some JavaScript development before and understand the JavaScript syntax. This book builds on that knowledge to give you a deeper understanding of DOM scripting and how to apply that to your projects. It uses this new understanding to describe what JavaScript libraries are and show you how they can be applied to your project. The book will also explain Ajax and how best to plan and apply it to your projects. It explains how to build simple animation objects for adding movement to elements on the page. There are straightforward examples that demonstrate the techniques used throughout the book.

JavaScript has seen a resurgence in popularity over the past few years, and with it has come an exploration of the power of the language as well as what it can do within the browser. This book will explain techniques new and old—such as closures, encapsulation, and inheritance—that many are using and how you can best apply them to your own projects.

By reading this book, you should have a greater understanding of how JavaScript works and be able to use advanced concepts such as closures and event delegation to build more flexible applications for the Web. You'll walk away with a greater appreciation for JavaScript libraries and how they can simplify and speed up your development. You'll also be able to implement Ajax effectively into your site, create special effects, use JavaScript libraries, and know how best to apply these libraries to your projects.

What you'll learn

  • Where CSS, HTML, and the DOM fit into modern scripting, and how to use them together effectively

  • Object-oriented programming techniques for more efficient JavaScript coding

  • How to use JavaScript libraries such as Prototype in your work

  • How to build effective form validation into your applications using Ajax

  • How to create mashups using APIs

  • How to build dynamic user interfaces

Who this book is for

This book is for beginner to intermediate developers, and already have knowledge of HTML, CSS, and JavaScript.

Table of contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
    1. Who This Book Is For
    2. How This Book Is Structured
    3. Prerequisites
    4. Contacting the Authors
  9. CHAPTER 1: The State of JavaScript
    1. JavaScript Is One of the Good Guys Again, but Why Now?
    2. JavaScript Meets HTML with the DOM
    3. The Rise of Ajax
    4. Managing JavaScript
    5. Debugging Your Code
    6. Summary
  10. CHAPTER 2: HTML, CSS, and JavaScript
    1. Getting into the Basics
    2. HTML Best Practices
    3. CSS Basics
    4. JavaScript Basics
    5. JavaScript and the DOM
    6. Moving Around the DOM
    7. Handling Attributes
    8. Inserting Content into the DOM
    9. Browser Sniffing vs. Object Detection
    10. Regular Expressions
    11. Code Formatting Practices
    12. Event Handling
    13. Event Delegation
    14. Summary
  11. CHAPTER 3: Object-Oriented Programming
    1. What Is Object-Oriented Programming?
    2. Functions
    3. Object Literals
    4. The for..in Loop
    5. Named Parameters
    6. Namespaces
    7. Closures
    8. Encapsulation
    9. Functional Programming
    10. Summary
  12. CHAPTER 4: Libraries
    1. Working with the DOM
    2. Application Conveniences
    3. Widgets
    4. Popular Libraries
    5. New Libraries
    6. How to Choose a Library
    7. Summary
  13. CHAPTER 5: Ajax and Data Exchange
    1. Examining an Ajax Application
    2. Deconstructing the Ajax Process
    3. Data Formats in Ajax
    4. Building a Reusable Ajax Object
    5. Planning for Failure
    6. Using Libraries to Handle Ajax Calls
    7. Summary
  14. CHAPTER 6: Visual Effects
    1. Why Use Visual Effects?
    2. Building a Simple Animation Object
    3. Extending the Animation Class
    4. Using Libraries for Animation
    5. Summary
  15. CHAPTER 7: Form Validation and JavaScript
    1. Doing It on the Server
    2. The Client Side
    3. Form Validation with Ajax
    4. Summary
  16. CHAPTER 8: Case Study: FAQ Facelift
    1. Layer 1: Target Practice
    2. Layer 2: JavaScript Boogaloo
    3. Summary
  17. CHAPTER 9: A Dynamic Help System
    1. The Job at Hand
    2. Planning and Preparation
    3. Writing the Markup
    4. Styling with CSS
    5. Enter Prototype and Low Pro
    6. Bringing Help to Life
    7. Finishing Touches
    8. Looking Back
    9. Summary
    10. Source Code
  18. Index

Product information

  • Title: Accelerated DOM Scripting with Ajax, APIs, and Libraries
  • Author(s): Jonathan Snook, Aaron Gustafson, Stuart Langridge, Dan Webb
  • Release date: September 2007
  • Publisher(s): Apress
  • ISBN: 9781590597644