| Introduction: How to Use This Book |
|
1 | (8) |
| Relating JavaScript to the World Wide Web |
|
2 | (2) |
| The Internet |
|
2 | (1) |
| The World Wide Web |
|
2 | (1) |
| JavaScript the Magnificent |
|
3 | (1) |
| Finding Exactly What You're Looking for in This Book |
|
4 | (1) |
| Understanding the Conventions Used in This Book |
|
5 | (2) |
| Figuring Out What the Icons Mean |
|
7 | (1) |
| Where to Go from Here |
|
8 | (1) |
| Part I: First Things First: Creating HTML Objects to Work within JavaScript |
|
9 | (26) |
|
Creating a Meat-and-Potatoes Web Page |
|
|
10 | (5) |
|
Body section: BODY...BODY |
|
|
11 | (1) |
|
Header section: HEAD...HEAD |
|
|
12 | (1) |
|
Interactive form: FORM...FORM |
|
|
12 | (1) |
|
JavaScript script: SCRIPT...SCRIPT |
|
|
13 | (1) |
|
|
|
14 | (1) |
|
Inserting Form Elements into Your Web Page |
|
|
15 | (6) |
|
ActiveX component: OBJECT...OBJECT |
|
|
15 | (1) |
|
|
|
16 | (2) |
|
|
|
18 | (1) |
|
Frame: FRAMESET...FRAME...FRAMESET |
|
|
18 | (1) |
|
|
|
19 | (1) |
|
|
|
20 | (1) |
|
Inserting Interactive Form Elements: INPUT |
|
|
21 | (8) |
|
|
|
22 | (1) |
|
|
|
22 | (1) |
|
|
|
23 | (1) |
|
|
|
23 | (1) |
|
|
|
24 | (1) |
|
|
|
24 | (1) |
|
|
|
25 | (1) |
|
|
|
25 | (2) |
|
|
|
27 | (1) |
|
|
|
27 | (1) |
|
|
|
28 | (1) |
|
Inserting a Java Applet: APPLET.../APPLET |
|
|
29 | (2) |
|
Mapping an Area: MAP...AREA.../MAP |
|
|
31 | (1) |
|
Plugging in a Plug-in: EMBED.../EMBED |
|
|
32 | (1) |
|
Specifying Useful Web Page Features |
|
|
33 | (2) |
|
CGI program to call on submit: FORM.../FORM |
|
|
34 | (1) |
|
Title for your Web page: TITLE.../TITLE |
|
|
34 | (1) |
| Part II: JavaScript Basics |
|
35 | (20) |
|
About JavaScript Security |
|
|
36 | (1) |
|
Basics of the JavaScript Object Model |
|
|
36 | (4) |
|
Built-in JavaScript data types |
|
|
37 | (1) |
|
Hierarchy of JavaScript objects |
|
|
37 | (2) |
|
|
|
39 | (1) |
|
Basic Punctuation and Syntax |
|
|
40 | (2) |
|
|
|
40 | (1) |
|
|
|
41 | (1) |
|
Spelling and capitalization (case) |
|
|
41 | (1) |
|
|
|
42 | (1) |
|
|
|
42 | (1) |
|
Conditional Expressions: if...else |
|
|
43 | (12) |
|
|
|
43 | (4) |
|
|
|
44 | (1) |
|
|
|
44 | (1) |
|
|
|
45 | (1) |
|
|
|
46 | (1) |
|
|
|
46 | (1) |
|
|
|
47 | (3) |
|
|
|
47 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
49 | (1) |
|
|
|
49 | (1) |
|
|
|
50 | (3) |
|
|
|
50 | (1) |
|
|
|
51 | (1) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
53 | (2) |
|
|
|
53 | (1) |
|
Assigning values to a variable |
|
|
53 | (1) |
|
|
|
53 | (1) |
|
Understanding variable scope |
|
|
54 | (1) |
| Part III: HTML Objects: The Heart of It All |
|
55 | (18) |
|
|
|
56 | (1) |
|
|
|
56 | (1) |
|
|
|
57 | (1) |
|
|
|
57 | (1) |
|
|
|
58 | (1) |
|
|
|
59 | (1) |
|
|
|
59 | (1) |
|
|
|
60 | (1) |
|
|
|
61 | (1) |
|
|
|
61 | (1) |
|
|
|
62 | (1) |
|
|
|
62 | (1) |
|
|
|
63 | (1) |
|
|
|
64 | (1) |
|
|
|
64 | (1) |
|
|
|
65 | (1) |
|
|
|
66 | (1) |
|
|
|
66 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
68 | (1) |
|
|
|
68 | (1) |
|
|
|
69 | (1) |
|
|
|
69 | (1) |
|
|
|
70 | (1) |
|
|
|
70 | (3) |
| Part IV: Data Types: Building Basic JavaScript Objects |
|
73 | (8) |
|
|
|
74 | (1) |
|
|
|
75 | (2) |
|
|
|
77 | (1) |
|
|
|
77 | (2) |
|
|
|
79 | (2) |
| Part V: Functions |
|
81 | (10) |
|
|
|
82 | (2) |
|
|
|
82 | (1) |
|
|
|
83 | (1) |
|
|
|
83 | (1) |
|
|
|
84 | (4) |
|
escape()--encodes a string |
|
|
84 | (1) |
|
eval()--evaluates a string |
|
|
84 | (1) |
|
|
|
85 | (1) |
|
parseFloat()--turns strings into floating-point numbers |
|
|
85 | (1) |
|
parseInt()--turns strings into integers |
|
|
86 | (1) |
|
unescape()--decodes a string |
|
|
87 | (1) |
|
Creating a Custom JavaScript Function |
|
|
88 | (1) |
|
With a fixed number of parameters |
|
|
88 | (1) |
|
With a variable number of parameters |
|
|
88 | (1) |
|
Functions that Help You Create and Work with Objects |
|
|
89 | (2) |
|
|
|
89 | (1) |
|
|
|
90 | (1) |
|
|
|
90 | (1) |
| Part VI: Methods: How an Object Behaves |
|
91 | (34) |
|
|
|
92 | (33) |
|
|
|
92 | (1) |
|
|
|
93 | (1) |
|
|
|
93 | (1) |
|
|
|
93 | (1) |
|
|
|
94 | (1) |
|
|
|
94 | (1) |
|
|
|
94 | (1) |
|
|
|
94 | (1) |
|
|
|
95 | (1) |
|
|
|
95 | (1) |
|
|
|
95 | (1) |
|
|
|
96 | (1) |
|
|
|
96 | (1) |
|
|
|
97 | (1) |
|
|
|
97 | (1) |
|
|
|
97 | (1) |
|
|
|
98 | (1) |
|
|
|
98 | (1) |
|
|
|
98 | (1) |
|
|
|
99 | (1) |
|
|
|
99 | (1) |
|
|
|
99 | (1) |
|
|
|
100 | (1) |
|
|
|
100 | (1) |
|
|
|
101 | (1) |
|
|
|
101 | (1) |
|
|
|
101 | (1) |
|
|
|
102 | (1) |
|
|
|
102 | (1) |
|
|
|
102 | (1) |
|
|
|
103 | (1) |
|
|
|
103 | (1) |
|
|
|
103 | (1) |
|
|
|
104 | (1) |
|
|
|
104 | (1) |
|
|
|
104 | (1) |
|
|
|
105 | (1) |
|
|
|
105 | (1) |
|
|
|
106 | (1) |
|
|
|
106 | (1) |
|
|
|
106 | (1) |
|
|
|
107 | (1) |
|
|
|
107 | (1) |
|
|
|
108 | (1) |
|
|
|
108 | (1) |
|
|
|
108 | (1) |
|
|
|
108 | (1) |
|
|
|
109 | (1) |
|
|
|
110 | (1) |
|
|
|
110 | (1) |
|
|
|
110 | (1) |
|
|
|
111 | (1) |
|
|
|
111 | (1) |
|
|
|
111 | (1) |
|
|
|
112 | (1) |
|
|
|
112 | (1) |
|
|
|
112 | (1) |
|
|
|
113 | (1) |
|
|
|
113 | (1) |
|
|
|
113 | (1) |
|
|
|
114 | (1) |
|
|
|
114 | (1) |
|
|
|
114 | (1) |
|
|
|
115 | (1) |
|
|
|
115 | (1) |
|
|
|
115 | (1) |
|
|
|
116 | (1) |
|
|
|
116 | (1) |
|
|
|
117 | (1) |
|
|
|
117 | (1) |
|
|
|
118 | (1) |
|
|
|
118 | (1) |
|
|
|
118 | (1) |
|
|
|
119 | (1) |
|
|
|
119 | (1) |
|
|
|
119 | (1) |
|
|
|
120 | (1) |
|
|
|
120 | (1) |
|
|
|
120 | (1) |
|
|
|
121 | (1) |
|
|
|
121 | (1) |
|
|
|
121 | (1) |
|
|
|
122 | (1) |
|
|
|
122 | (1) |
|
|
|
122 | (1) |
|
|
|
123 | (2) |
| Part VII: Properties (Object Data) |
|
125 | (24) |
|
|
|
126 | (23) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
128 | (1) |
|
|
|
128 | (1) |
|
|
|
128 | (1) |
|
|
|
128 | (1) |
|
|
|
128 | (1) |
|
|
|
129 | (1) |
|
defaultChecked (checkbox) |
|
|
129 | (1) |
|
|
|
129 | (1) |
|
|
|
129 | (1) |
|
|
|
129 | (1) |
|
|
|
130 | (1) |
|
|
|
130 | (1) |
|
|
|
130 | (1) |
|
|
|
130 | (1) |
|
|
|
130 | (1) |
|
|
|
130 | (1) |
|
|
|
131 | (1) |
|
|
|
131 | (1) |
|
|
|
131 | (1) |
|
|
|
131 | (1) |
|
|
|
132 | (1) |
|
|
|
132 | (1) |
|
|
|
132 | (1) |
|
|
|
132 | (1) |
|
|
|
133 | (1) |
|
|
|
133 | (1) |
|
|
|
133 | (1) |
|
|
|
133 | (1) |
|
|
|
134 | (1) |
|
|
|
134 | (1) |
|
|
|
134 | (1) |
|
|
|
134 | (1) |
|
|
|
135 | (1) |
|
|
|
136 | (1) |
|
|
|
136 | (1) |
|
|
|
136 | (1) |
|
|
|
136 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
138 | (1) |
|
|
|
138 | (1) |
|
|
|
139 | (1) |
|
|
|
139 | (1) |
|
|
|
139 | (1) |
|
|
|
139 | (1) |
|
|
|
140 | (1) |
|
|
|
140 | (1) |
|
|
|
140 | (1) |
|
|
|
140 | (1) |
|
|
|
141 | (1) |
|
|
|
141 | (1) |
|
|
|
142 | (1) |
|
|
|
142 | (1) |
|
|
|
142 | (1) |
|
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
145 | (1) |
|
|
|
145 | (1) |
|
|
|
145 | (1) |
|
|
|
145 | (1) |
|
|
|
146 | (1) |
|
|
|
146 | (1) |
|
|
|
146 | (1) |
|
|
|
147 | (1) |
|
|
|
147 | (1) |
|
|
|
148 | (1) |
|
|
|
148 | (1) |
|
|
|
148 | (1) |
|
|
|
148 | (1) |
| Part VIII: Event Handlers |
|
149 | (14) |
|
|
|
150 | (13) |
|
|
|
150 | (1) |
|
|
|
151 | (1) |
|
|
|
152 | (1) |
|
|
|
153 | (2) |
|
|
|
155 | (1) |
|
|
|
155 | (2) |
|
|
|
157 | (1) |
|
|
|
158 | (1) |
|
|
|
159 | (1) |
|
|
|
160 | (1) |
|
|
|
160 | (1) |
|
|
|
161 | (1) |
|
|
|
161 | (2) |
| Part IX: Cool Things You Can Do with JavaScript |
|
163 | (26) |
|
Adding Multimedia to Your Web Page |
|
|
164 | (2) |
|
|
|
164 | (1) |
|
|
|
165 | (1) |
|
|
|
165 | (1) |
|
|
|
165 | (1) |
|
Calling Other Components from JavaScript |
|
|
166 | (3) |
|
|
|
166 | (1) |
|
|
|
167 | (1) |
|
|
|
168 | (1) |
|
Creating Your Own JavaScript Objects |
|
|
169 | (1) |
|
Displaying Scrolling Text |
|
|
170 | (1) |
|
Displaying the Contents of Nested Objects |
|
|
171 | (2) |
|
|
|
173 | (3) |
|
Getting Started with a Bare-Bones HTML Template |
|
|
176 | (1) |
|
Hiding JavaScript Source Code from Users |
|
|
176 | (2) |
|
From JavaScript-enabled browsers |
|
|
177 | (1) |
|
From non-JavaScript-enabled browsers |
|
|
177 | (1) |
|
|
|
178 | (1) |
|
Loading and Running a JavaScript Script |
|
|
179 | (1) |
|
Looking at JavaScript Source Code |
|
|
180 | (1) |
|
Making an Embedded Image Respond to User Events |
|
|
180 | (1) |
|
Making Your Script Compatible with Non-JavaScript-Enabled Browsers |
|
|
181 | (1) |
|
Providing Feedback to Users with Pop-Up Messages |
|
|
181 | (1) |
|
|
|
182 | (1) |
|
Saving JavaScript files as HTML source code |
|
|
182 | (1) |
|
Saving JavaScript files as text |
|
|
182 | (1) |
|
Using JavaScript to Calculate Values for HTML Tags |
|
|
183 | (1) |
|
|
|
183 | (4) |
|
Validating before the form is submitted |
|
|
184 | (1) |
|
Validating one field at a time |
|
|
185 | (2) |
|
Web-Surfing: Creating Hypertext Links |
|
|
187 | (2) |
|
Creating links between Web pages |
|
|
187 | (1) |
|
Creating links within a single Web page |
|
|
188 | (1) |
| Appendix A: Reserved Words |
|
189 | (2) |
| Appendix B: Color Values |
|
191 | (6) |
| Glossary: Techie Talk |
|
197 | (6) |
| Index |
|
203 | |
| Reader Response Card |
|
Back of Book | |