| Introduction | xv |
Chapter 1 | An Inside Look at JavaScript | 1 |
| Answers to Common Questions About JavaScript | 2 |
| JavaScript: A Limited-Featured Programming Language | 3 |
| Getting Down to JavaScript | 4 |
| Object Name | 4 |
| Property | 5 |
| Methods | 5 |
| The Dot Syntax | 6 |
| The Main Event | 6 |
| Writing Your First JavaScript | 7 |
| "Old Timers" Don't Like JavaScript | 10 |
| Spicing Up Your JavaScript | 11 |
| Looking Ahead | 12 |
| Quiz | 12 |
Chapter 2 | Variables, Operators, and Expressions | 15 |
| Values and Variables | 16 |
| Values | 16 |
| Variables | 17 |
| Operators and Expressions | 24 |
| Parts of an Expression | 24 |
| Multiple Operations | 24 |
| Types of Operators | 25 |
| Looking Ahead | 40 |
| Quiz | 40 |
Chapter 3 | Condition Statements | 43 |
| if Statement | 45 |
| The if Statement in Action | 45 |
| The if...else Statement | 46 |
| The if...else if Statement | 48 |
| Other Variations of the if Statement | 52 |
| Nested if Statement | 53 |
| Identifying a Browser | 55 |
| switch...case Statement | 58 |
| Loop Statement | 62 |
| The for Loop | 62 |
| The for in Loop | 66 |
| The while Loop | 68 |
| The do...while Loop | 70 |
| continue | 71 |
| Looking Ahead | 72 |
| Quiz | 73 |
Chapter 4 | Arrays | 75 |
| What Is an Array? | 75 |
| Declaring an Array | 76 |
| Initializing an Array | 77 |
| Defining Array Elements | 78 |
| How Many Elements Are in the Array? | 79 |
| Looping the Array | 80 |
| Adding an Array Element | 82 |
| Sorting Array Elements | 83 |
| Making a New Array from an Existing Array | 84 |
| Combining Array Elements into a String | 87 |
| Changing Elements of the Array | 90 |
| Looking Ahead | 91 |
| Quiz | 92 |
Chapter 5 | Functions | 95 |
| What Is a Function? | 96 |
| Defining a Function | 96 |
| Writing a Function Definition | 98 |
| Adding Arguments | 99 |
| The Scope of Variables and Arguments | 100 |
| Calling a Function | 101 |
| Calling a Function Without an Argument | 102 |
| Calling a Function with an Argument | 103 |
| Calling a Function from HTML | 104 |
| Functions Calling Another Function | 108 |
| Returning Values from a Function | 109 |
| Looking Ahead | 113 |
| Quiz | 114 |
Chapter 6 | Strings | 117 |
| Why Manipulate a String? | 117 |
| Joining Strings | 118 |
| Finding Your Way Around a String | 120 |
| Dividing Text | 123 |
| Copying a Substring | 125 |
| Converting Number and Strings | 129 |
| Numbers to Strings | 130 |
| Changing the Case of the String | 131 |
| Strings and Unicode | 132 |
| Looking Ahead | 132 |
| Quiz | 133 |
Chapter 7 | Forms and Event Handling | 135 |
| Building Blocks of a Form | 136 |
| Elements and JavaScript | 136 |
| Responding to Form Events | 137 |
| Form Objects and Elements | 141 |
| Time-Saving Shortcut | 143 |
| Changing Attribute Values Dynamically | 144 |
| Changing Elements Based on a Value Selected by the User | 146 |
| Changing an Option List Dynamically | 148 |
| Evaluating Check Box Selections | 151 |
| Manipulating Elements Before the Form Is Submitted | 153 |
| Using Intrinsic JavaScript Functions | 155 |
| Changing Labels Dynamically | 156 |
| Disabling Elements | 159 |
| Read-Only Elements | 161 |
| Looking Ahead | 162 |
| Quiz | 163 |
Chapter 8 | Cookies | 165 |
| Cookie Basics | 166 |
| Creating a Cookie | 167 |
| Reading a Cookie | 169 |
| Setting the Expiration Date | 171 |
| Deleting a Cookie | 172 |
| Personalizing an Experience Using a Cookie | 174 |
| Looking Ahead | 176 |
| Quiz | 176 |
Chapter 9 | Browser Windows | 179 |
| Open the Window, Please! | 180 |
| Giving the New Window Focus | 182 |
| Placing the Window into Position on the Screen | 184 |
| Changing the Contents of a Window | 186 |
| Closing the Window | 187 |
| "Magically" Scrolling a Web Page | 190 |
| Opening Multiple Windows at Once | 191 |
| Creating a Web Page in a New Window | 192 |
| Looking Ahead | 195 |
| Quiz | 196 |
Chapter 10 | Regular Expressions | 199 |
| What Is a Regular Expression? | 200 |
| The Language of a Regular Expression | 201 |
| Finding Nonmatching Characters | 204 |
| Entering a Range of Characters | 205 |
| Matching Digits and Nondigits | 205 |
| Matching Punctuation and Symbols | 206 |
| Matching Words | 206 |
| Replace Text Using a Regular Expression | 207 |
| Replacing Like Values | 208 |
| Return the Matched Characters | 209 |
| The Telephone Number Match | 210 |
| Regular Expression Object Properties | 213 |
| Looking Ahead | 214 |
| Quiz | 215 |
Chapter 11 | JavaScript and Frames | 217 |
| You've Been Framed! | 218 |
| Invisible Borders | 220 |
| Calling a Child Window's JavaScript Function | 222 |
| Changing the Content of a Child Window | 223 |
| Changing the Focus of a Child Window | 226 |
| Writing to a Child Window from a JavaScript | 226 |
| Accessing Elements of Another Child Window | 228 |
| Looking Ahead | 228 |
| Quiz | 229 |
Chapter 12 | Rollovers | 231 |
| Setting the Stage | 232 |
| Creating a Rollover | 234 |
| Text Rollovers | 237 |
| Multiple Actions for a Rollover | 239 |
| More Efficient Rollovers | 243 |
| Looking Ahead | 245 |
| Quiz | 245 |
Chapter 13 | Getting Your Message Across: The Status Bar, Banners, and Slideshows | 249 |
| Making Magic Using the Status Bar | 250 |
| Building a Static Message | 250 |
| Changing the Message Using Rollovers | 253 |
| Moving the Message Along the Status Bar | 256 |
| Banner Advertisements | 268 |
| Loading and Displaying Banner Advertisements | 268 |
| Linking Banner Advertisements to URLs | 271 |
| Creating a Slideshow | 273 |
| Looking Ahead | 275 |
| Quiz | 276 |
Chapter 14 | Protecting Your Web Page | 279 |
| Hiding Your Code | 280 |
| Disabling the Right Mouse Button | 280 |
| Hiding Your JavaScript | 283 |
| Concealing Your E-mail Address | 286 |
| Looking Ahead | 288 |
| Quiz | 288 |
Chapter 15 | Menus | 291 |
| Creating a Pull-Down Menu | 292 |
| Dynamically Changing a Menu | 294 |
| Validating Menu Selections | 296 |
| Creating DHTML Menus | 298 |
| Floating Menu | 299 |
| Chain Select Menu | 299 |
| Tab Menu | 300 |
| Popup Menu | 300 |
| Highlighted Menu | 301 |
| Folding Tree Menu | 301 |
| Microsoft Outlook Bar Style Menu | 302 |
| Context Menu | 303 |
| Scrollable Menu | 303 |
| Side Bar Menu | 304 |
| Slide-In Menu | 304 |
| Looking Ahead | 305 |
| Quiz | 306 |
Chapter 16 | DHTML | 309 |
| What Is DHTML? | 310 |
| Learning DHTML | 310 |
| Cascading Style Sheets | 311 |
| Using DHTML Code | 313 |
| Generic Drag | 313 |
| LCD Clock All | 316 |
| Watermark Background Image | 319 |
| Tabbed Document Viewer Using iframe | 319 |
| Daily iframe Content | 323 |
| Cross-Browser Marquee | 325 |
| Popup Calendar | 325 |
| Drop-In Content Box | 325 |
| Ad Box | 326 |
| Quiz | 327 |
| Appendix | 329 |
| Final Exam | 333 |
| Answers to Quizzes and Final Exam | 349 |
| Index | 361 |