Professional Documents
Culture Documents
Preface
xix
AL
RI TE MA D TE GH
3
5
Try It
Lesson Requirements Step-by-Step
6
6 6
Variables
9
12 21
22 22
22 23
Lesson 3: FunCtIons
RI
25
CO
Function Declarations Functions as Values Passing Functions to Other Functions Returning Functions Try It
PY
26 29 30 31 32
32 32
35
Conditional Statements
Comparison Operators Logical Operators Assigning the Results of Conditions
35
35 38 41
647837ftoc.indd 9
10/27/10 1:46:19 AM
CONTENTS
41
41 43 45
Try It
Lesson Requirements Step-by-Step
45
45 46
Lesson 5: Loops
49
Loop Basics The for Loop The while Loop The do-while Loop Try It
Lesson Requirements Step-by-Step
49 50 52 52 53
53 54
Lesson 6: sCope
57
Global Scope Functional Scope No Block-Level Scopes Variable Declarations Identifier Lookup Try It
Lesson Requirements Step-by-Step
57 58 60 61 61 62
62 63
65
65 66 67
67 73
Number
String
75
76
Try It
Lesson Requirements Step-by-Step
79
79 79
647837ftoc.indd 10
10/27/10 1:46:20 AM
CONTENTS
83
83
85 86
86 88
88 88
91
Using the prototype Object Inheriting Members from Other Objects Try It
Lesson Requirements Step-by-Step
92 94 96
96 96
101
102 103
103
103 104 104
105
105 106
Try It
Lesson Requirements Step-by-Step
106
106 107
109
Opening New Windows Manipulating Windows Coding between Windows Security Try It
Lesson Requirements Step-by-Step
647837ftoc.indd 11
10/27/10 1:46:20 AM
CONTENTS
121
121 125
125 126
129
What Is the DOM? Navigating the DOM Selecting Element Nodes Try It
Lesson Requirements Step-by-Step
137
137
138 139 140
142 142
142 143
147
155
Mouse Events
Movement-Based Events Button-Based Events
157
157 157
xii
647837ftoc.indd 12
10/27/10 1:46:20 AM
CONTENTS
161
17 3
173 175
175 176
185
195
205
205 206
206 207
Try It
Lesson Requirements Step-by-Step
209
209 210
xiii
647837ftoc.indd 13
10/27/10 1:46:20 AM
CONTENTS
217
217 218
218 219
Try It
Lesson Requirements Step-by-Step
220
220 221
225
235
235
236 237
238 238
239 239
249
Setting a Delay the setTimeout() Method Setting an Interval the setInterval() Method Try It
Lesson Requirements Step-by-Step
261
261 262
263 263 264 264
xiv
647837ftoc.indd 14
10/27/10 1:46:20 AM
CONTENTS
264 264
Try It
Lesson Requirements Step-by-Step
265
265 265
267
Try It
Lesson Requirements Step-by-Step
269
269 270
27 3
The Textbox The Password Textbox The Hidden Textbox The Multiline Textbox Try It
Lesson Requirements Step-by-Step
283
295
305
What Is Ajax?
Google Suggest Google Maps
306
306 306
308
xv
647837ftoc.indd 15
10/27/10 1:46:20 AM
CONTENTS
311
311
312 312
321
329
339
XML Rules the WorldOr Does It? JavaScript Object Notation Saves the World Converting to and from JSON Try It
Lesson Requirements Step-by-Step
353 354
xvi
647837ftoc.indd 16
10/27/10 1:46:20 AM
CONTENTS
355 356
357
367
368
371 372
Try It
Lesson Requirements Step-by-Step
373
373 374
37 7
Use Whitespace Variable Declarations Avoid the Global Scope Use Literals
Lesson 40: separatIng JavasCrIpt and htML
Try It
Lesson Requirements Step-by-Step
382
383 383
Lesson 41: separatIng JavasCrIpt and Css Lesson 42: avoIdIng gLobaL sCope
387 389
xvii
647837ftoc.indd 17
10/27/10 1:46:20 AM
CONTENTS
399
Refactoring Code
Refactoring Duplicate Code Reducing Statements
399
400 401
402
403 404
405 406
406 407
413
System Requirements Using the DVD on a PC Using the DVD on a Mac Whats on the DVD Troubleshooting Customer Care
Index
xviii
647837ftoc.indd 18
10/27/10 1:46:20 AM