Synopses & Reviews
If you're new to JavaScript, or an experienced web developer looking to improve your skills, Learning JavaScript provides you with complete, no-nonsense coverage of this quirky yet essential language for web development. You'll learn everything from primitive data types to complex features, including JavaScript elements involved with Ajax and dynamic page effects. By the end of the book, you'll be able to work with even the most sophisticated libraries and web applications.
Complete with best practices and examples of JavaScript use, this new edition shows you how to integrate the language with the browser environment, and how to practice proper coding techniques for standards-compliant websites. This book will help you:
- Learn the JavaScript application structure, including basic statements and control structures
- Identify JavaScript objects—String, Number, Boolean, Function, and more
- Use browser debugging tools and troubleshooting techniques
- Understand event handling, form events, and JavaScript applications with forms
- Develop with the Browser Object Model, the Document Object Model, and custom objects you create
- Learn about browser cookies and more modern client-side storage techniques
- Get details for using XML or JSON with Ajax applications
Learning JavaScript follows proven learning principles to help you absorb the concepts at an easy pace, so you'll learn how to create powerful and responsive applications in any browser.
Synopsis
JavaScript beginners will find no-nonsense coverage of this quirky yet essential language for web development -- taught at a pace they'll enjoy. JavaScript has grown in prominence with the advent of Ajax web development. This book teaches readers proper JavaScript coding techniques by combining the latest examples of standards-compliant web development with proven learning principles. By the end of the book, readers will have the skills to create basic JavaScript applications.
About the Author
Shelley Powers has been working with, and writing about, web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 12 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado, who enjoys applying her latest experiments on her many web sites.
Table of Contents
Preface; Audience; Assumptions and Approach; How the Book Is Organized; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Hello JavaScript!; 1.1 Hello World!; 1.2 Hello World! Once Again; 1.3 JavaScript Files; 1.4 Accessibility and JavaScript Best Practices; Chapter 2: JavaScript Data Types and Variables; 2.1 Identifying Variables; 2.2 Primitive Types; 2.3 The String Data Type; 2.4 The Boolean Data Type; 2.5 The Number Data Type; 2.6 The null and undefined Variables; 2.7 Constants: Named but Not Variables; 2.8 Test Your Knowledge: Quiz; 2.9 Test Your Knowledge: Answers; Chapter 3: Operators and Statements; 3.1 The Format of a JavaScript Statement; 3.2 The Assignment Statement; 3.3 Conditional Statements and Program Flow; 3.4 The Conditional Operators; 3.5 The Logical Operators; 3.6 Advanced Statements: The Loops; 3.7 Test Your Knowledge: Quiz; 3.8 Test Your Knowledge: Answers; Chapter 4: The JavaScript Objects; 4.1 Primitive Data Types As Objects; 4.2 Boolean, Number, and String; 4.3 Regular Expressions and RegExp; 4.4 The Date Object; 4.5 The Math Object; 4.6 JavaScript Arrays; 4.7 Test Your Knowledge: Quiz; 4.8 Test Your Knowledge: Answers; Chapter 5: Functions; 5.1 Declarative Functions; 5.2 Anonymous Functions; 5.3 Function Literals; 5.4 Function Type Summary; 5.5 Function Scope; 5.6 Function As Object; 5.7 Test Your Knowledge: Quiz; 5.8 Test Your Knowledge: Answers; Chapter 6: Troubleshooting, Debugging, and Cross-Browser Issues; 6.1 Simple Ways to Debug; 6.2 Development and Debugging Tools by Browser; 6.3 Dealing with Cross-Browser Differences; 6.4 Test Your Knowledge: Quiz; 6.5 Test Your Knowledge: Answers; Chapter 7: Catching Events; 7.1 The Events; 7.2 Level 0 Event Handling; 7.3 The DOM Level 2 Event Model; 7.4 Test Your Knowledge: Quiz; 7.5 Test Your Knowledge: Answers; Chapter 8: Forms, Form Events, and Validation; 8.1 Attaching Events to Forms: Different Approaches; 8.2 Selection; 8.3 Radio Buttons and Checkboxes; 8.4 The text, textarea, password, and hidden Input Elements; 8.5 Input Fields and Regular Expression Validation; 8.6 Forms, the Sandbox, and XSS; 8.7 Test Your Knowledge: Quiz; 8.8 Test Your Knowledge: Answers; Chapter 9: Browser As Puzzle Box; 9.1 The Structure of the Browser at a Glance; 9.2 The window Object; 9.3 Creating and Controlling Windows; 9.4 Frames; 9.5 Adding and Controlling Timers; 9.6 The history, screen, and navigator Objects; 9.7 The Document Object; 9.8 innerHTML; 9.9 Test Your Knowledge: Quiz; 9.10 Test Your Knowledge: Answers; Chapter 10: Cookies and Other Client-Side Storage Techniques; 10.1 The JavaScript Sandbox and Cookie Security; 10.2 All About Cookies; 10.3 Flash Shared Objects, Google Gears, and HTML5 DOM Storage; 10.4 Test Your Knowledge: Quiz; 10.5 Test Your Knowledge: Answers; Chapter 11: The DOM, or Web Page As Tree; 11.1 A Tale of Two Interfaces; 11.2 The DOM HTML API; 11.3 Understanding the DOM: The Core API; 11.4 Element and Access in Context; 11.5 Modifying the Tree; 11.6 Test Your Knowledge: Quiz; 11.7 Test Your Knowledge: Answers; Chapter 12: Dynamic Pages; 12.1 JavaScript, CSS, and the DOM; 12.2 Fonts and Text; 12.3 Position and Movement; 12.4 Size and Clipping; 12.5 Display, Visibility, and Opacity; 12.6 Revisiting the DOM: Collapsing Forms, Query Selectors, and Class Names; 12.7 Test Your Knowledge: Quiz; 12.8 Test Your Knowledge: Answers; Chapter 13: Creating Custom JavaScript Objects; 13.1 The JavaScript Object and Prototyping; 13.2 Creating Your Own Custom JavaScript Objects; 13.3 Object Encapsulation; 13.4 Chaining Constructors and JavaScript Inheritance; 13.5 One-Off Objects; 13.6 Object Libraries: Packaging Your Objects for Reuse; 13.7 Advanced Error Handling Techniques (try, throw, catch); 13.8 Test Your Knowledge: Quiz; 13.9 Test Your Knowledge: Answers; Chapter 14: Moving Outside the Page with Ajax; 14.1 How Ajax Works; 14.2 Hello Ajax World!; 14.3 The XMLHttpRequest Object and Preparing to Send the Request; 14.4 Processing the Web Request Return; 14.5 Ajax: It's Not Only Code; 14.6 JavaScript and Ajax Libraries; 14.7 Test Your Knowledge: Quiz; 14.8 Test Your Knowledge: Answers; Chapter 15: Ajax Data: XML or JSON?; 15.1 XML-Formatted Ajax Results; 15.2 JavaScript Object Notation; 15.3 Test Your Knowledge: Quiz; 15.4 Test Your Knowledge: Answers; Colophon;