Introduction |
|
1 | (4) |
|
|
2 | (1) |
|
|
3 | (1) |
|
|
3 | (2) |
Chapter 1: Getting Started with JavaScript |
|
5 | (16) |
|
|
6 | (5) |
|
What Can JavaScript Do for Us? |
|
|
6 | (2) |
|
The Advantages and Disadvantages of JavaScript |
|
|
8 | (3) |
|
|
11 | (4) |
|
|
12 | (2) |
|
|
14 | (1) |
|
|
15 | (2) |
|
Simple JavaScript Example |
|
|
17 | (4) |
Chapter 2: Data and Decisions |
|
21 | (38) |
|
Data, Data Types, and Data Operators |
|
|
22 | (10) |
|
|
22 | (2) |
|
|
24 | (3) |
|
|
27 | (2) |
|
Converting Different Types of Data |
|
|
29 | (3) |
|
The Composite Data Types: Array and Object |
|
|
32 | (7) |
|
The String, Date, and Math Objects |
|
|
32 | (7) |
|
|
39 | (5) |
|
The Array Object's Methods and Properties |
|
|
42 | (2) |
|
Making Decisions in JavaScript |
|
|
44 | (15) |
|
The Logical and Comparison Operators |
|
|
44 | (3) |
|
|
47 | (3) |
|
Checking a Number of Conditions: the Switch statement |
|
|
50 | (2) |
|
|
52 | (7) |
Chapter 3: Functions and Code Design |
|
59 | (30) |
|
|
59 | (10) |
|
|
60 | (2) |
|
|
62 | (7) |
|
|
69 | (8) |
|
|
70 | (1) |
|
|
71 | (1) |
|
|
72 | (1) |
|
|
72 | (1) |
|
Keep the Number of Exit Points to a Minimum |
|
|
73 | (1) |
|
Use Variables for Special Values |
|
|
74 | (1) |
|
Keep Related Code Together |
|
|
75 | (1) |
|
|
76 | (1) |
|
Use Variables for Just One Purpose |
|
|
76 | (1) |
|
|
76 | (1) |
|
Functions Should Do One Thing and Do it Well |
|
|
76 | (1) |
|
Organizing and Reusing Code |
|
|
77 | (12) |
|
Creating Code Modules with .js Files |
|
|
78 | (2) |
|
Creating our own Objects with JavaScript Classes |
|
|
80 | (9) |
Chapter 4: Interacting with the Web Browser |
|
89 | (36) |
|
|
89 | (4) |
|
Modifying our Page with JavaScript |
|
|
93 | (17) |
|
Changing the Page as it Downloads |
|
|
93 | (1) |
|
Changing the Page after it has Downloaded |
|
|
94 | (16) |
|
|
95 | (5) |
|
Dynamically Changing Links |
|
|
100 | (2) |
|
|
102 | (8) |
|
|
110 | (11) |
|
|
111 | (2) |
|
|
113 | (1) |
|
|
114 | (7) |
|
Checking the User's Browser |
|
|
121 | (4) |
|
|
121 | (1) |
|
|
122 | (3) |
Chapter 5: Windows and Frames |
|
125 | (38) |
|
Basic Built-In Dialog Windows |
|
|
125 | (4) |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
127 | (2) |
|
Creating New Browser Windows |
|
|
129 | (14) |
|
Communicating Between Windows |
|
|
138 | (1) |
|
|
139 | (2) |
|
|
141 | (2) |
|
|
143 | (9) |
|
Documents within Documents |
|
|
143 | (2) |
|
Multiple Windows within Window |
|
|
145 | (3) |
|
|
146 | (1) |
|
|
147 | (1) |
|
|
148 | (2) |
|
|
150 | (2) |
|
Image Viewer Application - Part 1 |
|
|
152 | (11) |
|
|
153 | (1) |
|
|
154 | (1) |
|
Stylizing the Application |
|
|
155 | (1) |
|
Preventing JavaScript Errors |
|
|
156 | (1) |
|
Allowing for Smaller Screens |
|
|
156 | (1) |
|
|
157 | (6) |
Chapter 6: DHTML for IE4 and NN4 |
|
163 | (30) |
|
The Need for Cascading Style Sheets (CSS) |
|
|
164 | (2) |
|
|
166 | (2) |
|
Manipulating CSS with JavaScript |
|
|
168 | (6) |
|
|
169 | (3) |
|
|
172 | (2) |
|
Writing Cross-Browser DHTML |
|
|
174 | (5) |
|
The Difficulties with Cross-Browser DHTML |
|
|
175 | (4) |
|
Technique 1: Using document.all Collection Test |
|
|
178 | (1) |
|
Technique 2: Using the document.layers Collection Test |
|
|
178 | (1) |
|
Technique 3: Using a Browser Sniffer |
|
|
178 | (1) |
|
ImageViewer: Part II: Adding DHTML and CSS |
|
|
179 | (14) |
|
Applying CSS/CSSP Stylesheets |
|
|
179 | (3) |
|
|
182 | (6) |
|
|
188 | (5) |
Chapter 7: The DOM: DHTML for the Latest Browsers |
|
193 | (44) |
|
|
194 | (1) |
|
|
195 | (15) |
|
|
197 | (2) |
|
Accessing Parts of a Document |
|
|
199 | (7) |
|
|
199 | (3) |
|
Traversing the Document Structure |
|
|
202 | (2) |
|
|
204 | (2) |
|
Manipulating the Document |
|
|
206 | (14) |
|
Mutating the Document Structure |
|
|
207 | (1) |
|
|
208 | (1) |
|
|
209 | (1) |
|
|
210 | (3) |
|
|
213 | (7) |
|
|
220 | (10) |
|
|
221 | (3) |
|
Choosing an Event Binding Method |
|
|
223 | (1) |
|
|
224 | (2) |
|
Canceling Event Propagation |
|
|
226 | (4) |
|
Image Viewer Application - Part 3 |
|
|
230 | (7) |
|
Thumbnail HTML Page Template |
|
|
231 | (1) |
|
Event Binding for the Thumbnail Pages |
|
|
232 | (5) |
Chapter 8: Advanced Form Techniques |
|
237 | (38) |
|
|
237 | (19) |
|
Adding Elements to a Select Control |
|
|
237 | (5) |
|
Creating Your Own Controls with DHTML |
|
|
242 | (14) |
|
The E-commerce Image Viewer - Part 1 |
|
|
256 | (11) |
|
|
256 | (6) |
|
|
262 | (5) |
|
|
267 | (8) |
Chapter 9: Passing Information Between Web Pages and Data Storage |
|
275 | (64) |
|
Keeping Information Alive |
|
|
275 | (9) |
|
Passing Information with URLs |
|
|
276 | (6) |
|
Maintaining State with Session Variables |
|
|
282 | (2) |
|
Permanently Storing Information: Cookies |
|
|
284 | (15) |
|
Reading and Writing Cookies |
|
|
285 | (3) |
|
Making Cookies Easy: Cookie Functions |
|
|
288 | (11) |
|
The E-commerce Image Viewer Application - Part 2 |
|
|
299 | (40) |
|
Creating the Shopping Cart Classes |
|
|
300 | (21) |
|
|
321 | (18) |
Chapter 10: Data Validation Techniques |
|
339 | (38) |
|
Validation of Different Types of Information |
|
|
339 | (21) |
|
|
340 | (2) |
|
|
342 | (5) |
|
|
347 | (1) |
|
Validating an E-mail Address |
|
|
348 | (2) |
|
|
350 | (3) |
|
Validating a Credit Card Number |
|
|
353 | (7) |
|
Image Viewer E-commerce Application - Part 3 |
|
|
360 | (17) |
|
Adding Automatic Form Validation |
|
|
360 | (12) |
|
Updating the Personal Details Page |
|
|
372 | (1) |
|
Updating the Credit Card Details Page |
|
|
372 | (5) |
Index |
|
377 | |