| |
| |
Introduction | |
| |
| |
Who This Book Is For | |
| |
| |
The Aims of This Book | |
| |
| |
Conventions Used | |
| |
| |
Q&A, Quiz, and Exercises | |
| |
| |
How the Book Is Organized | |
| |
| |
Tools You'll Need | |
| |
| |
| |
First Steps with JavaScript | |
| |
| |
| |
Introducing JavaScript | |
| |
| |
Web Scripting Fundamentals | |
| |
| |
Server- Versus Client-Side Programming | |
| |
| |
JavaScript in a Nutshell | |
| |
| |
Where JavaScript Came From | |
| |
| |
The <script> Tag | |
| |
| |
Introducing the DOM | |
| |
| |
Talking to the User | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Writing Simple Scripts | |
| |
| |
Including JavaScript in Your Web Page | |
| |
| |
JavaScript Statements | |
| |
| |
Variables | |
| |
| |
Operators | |
| |
| |
Capturing Mouse Events | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Using Functions | |
| |
| |
General Syntax | |
| |
| |
Calling Functions | |
| |
| |
Arguments | |
| |
| |
Returning Values from Functions | |
| |
| |
Scope of Variables | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
DOM Objects and Built-In Objects | |
| |
| |
Interacting with the User | |
| |
| |
Selecting Elements by Their id | |
| |
| |
Accessing Browser History | |
| |
| |
Using the location Object | |
| |
| |
Browser Information-The navigator Object | |
| |
| |
Dates and Times | |
| |
| |
Simplifying Calculation with the Math Object | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Different Types of Data | |
| |
| |
Numbers | |
| |
| |
Strings | |
| |
| |
Boolean Values | |
| |
| |
Arrays | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
More Advanced JavaScript | |
| |
| |
| |
Scripts That Do More | |
| |
| |
Conditional Statements | |
| |
| |
Loops and Control Structures | |
| |
| |
Debugging Your Scripts | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Object Oriented Programming | |
| |
| |
What Is Object Oriented Programming (OOP)? | |
| |
| |
Object Creation | |
| |
| |
Extending and Inheriting Objects Using prototype | |
| |
| |
Encapsulation | |
| |
| |
Using Feature Detection | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Meet JSON | |
| |
| |
What Is JSON? | |
| |
| |
Accessing JSON Data | |
| |
| |
Data Serialization with JSON | |
| |
| |
JSON Data Types | |
| |
| |
Simulating Associative Arrays | |
| |
| |
Creating Objects with JSON | |
| |
| |
JSON Security | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Responding to Events | |
| |
| |
Understanding Event Handlers | |
| |
| |
Default Actions | |
| |
| |
The event Object | |
| |
| |
Cross-Browser Event Handlers | |
| |
| |
Advanced Event Handler Registration | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
JavaScript and Cookies | |
| |
| |
What Are Cookies? | |
| |
| |
The document.cookie Property | |
| |
| |
Cookie Ingredients | |
| |
| |
Writing a Cookie | |
| |
| |
A Function to Write a Cookie | |
| |
| |
Reading a Cookie | |
| |
| |
Deleting Cookies | |
| |
| |
Setting Multiple Values in a Single Cookie | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Working with the Document Object Model (DOM) | |
| |
| |
| |
Navigating the DOM | |
| |
| |
DOM Nodes | |
| |
| |
Selecting Elements with getElementsByTagName() | |
| |
| |
Reading an Element's Attributes | |
| |
| |
Mozilla's DOM Inspector | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Scripting the DOM | |
| |
| |
Creating New Nodes | |
| |
| |
Manipulating Child Nodes | |
| |
| |
Editing Element Attributes | |
| |
| |
Dynamically Loading JavaScript Files | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
JavaScript and CSS | |
| |
| |
A Ten Minute CSS Primer | |
| |
| |
The DOM style Property | |
| |
| |
Accessing Classes Using className | |
| |
| |
The DOM stylesheets Object | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Good Coding Practice | |
| |
| |
Don't Overuse JavaScript | |
| |
| |
Writing Readable and Maintainable Code | |
| |
| |
Graceful Degradation | |
| |
| |
Progressive Enhancement | |
| |
| |
Unobtrusive JavaScript | |
| |
| |
Feature Detection | |
| |
| |
Handling Errors Well | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Graphics and Animation | |
| |
| |
Preloading Images | |
| |
| |
Animating Page Elements | |
| |
| |
Animating Transparency | |
| |
| |
CSS3 Transitions, Transformations, and Animations | |
| |
| |
Scripting DOM Positioning | |
| |
| |
Optimizing Performance | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Ajax | |
| |
| |
| |
Introducing Ajax | |
| |
| |
The Anatomy of Ajax | |
| |
| |
The XMLHttpRequest Object | |
| |
| |
Creating Instances of XMLHttpRequest | |
| |
| |
Sending the Server Request | |
| |
| |
Monitoring Server Status | |
| |
| |
Callback Functions | |
| |
| |
responseText and responseXML Properties | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Creating a Simple Ajax Library | |
| |
| |
An Ajax Library | |
| |
| |
Implementing the Library | |
| |
| |
Using the Library | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Solving Ajax Problems | |
| |
| |
Debugging Ajax Applications | |
| |
| |
Common Ajax Errors | |
| |
| |
Some Programming Gotchas | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Using JavaScript Libraries | |
| |
| |
| |
Making Life Easier with Libraries | |
| |
| |
Why Use a Library? | |
| |
| |
What Sorts of Things Can Libraries Do? | |
| |
| |
Some Popular Libraries | |
| |
| |
Introducing prototype.js | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
A Closer Look at jQuery | |
| |
| |
Including jQuery in Your Pages | |
| |
| |
jQuery's $(document).ready Handler | |
| |
| |
Selecting Page Elements | |
| |
| |
Working with HTML Content | |
| |
| |
Showing and Hiding Elements | |
| |
| |
Animating Elements | |
| |
| |
Command Chaining | |
| |
| |
Handling Events | |
| |
| |
Using jQuery to Implement Ajax | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
The jQuery Ul User Interface Library | |
| |
| |
What jQuery Ul Is All About | |
| |
| |
How to Include jQuery Ul in Your Pages | |
| |
| |
Interactions | |
| |
| |
Using Widgets | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
Using JavaScript with Other Web Technologies | |
| |
| |
| |
JavaScript and Multimedia | |
| |
| |
Multimedia Formats | |
| |
| |
Browser Plug-Ins | |
| |
| |
Using an Anchor Tag | |
| |
| |
Using <embed> and <object> | |
| |
| |
Rash | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
HTML5 and JavaScript | |
| |
| |
New Markup for HTML5 | |
| |
| |
Some Important New Elements | |
| |
| |
Drag and Drop | |
| |
| |
Local Storage | |
| |
| |
Working with Local Files | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exercises | |
| |
| |
| |
JavaScript Beyond the Web Page | |
| |
| |
JavaScript Outside the Browser | |
| |
| |
Writing Google Chrome Extensions | |
| |
| |
Summary | |
| |
| |
Q&A | |
| |
| |
Workshop | |
| |
| |
Exorcises | |
| |
| |
| |
Appendices | |
| |
| |
| |
Tools for JavaScript, Development | |
| |
| |
Editors | |
| |
| |
Validators | |
| |
| |
Debugging and Verifying Tools | |
| |
| |
| |
JavaScript Quick | |
| |
| |
Reference | |
| |
| |
Index | |