Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content in Web Pages p. 6 Client-Side JavaScript Features p. 8 JavaScript Security p. 12 Example: Computing Loan Payments with JavaScript p. 12 Using the Rest of This Book p. 16 Exploring JavaScript p. 18 Core JavaScript Lexical Structure p. 23 Character Set p. 23 Case Sensitivity p. 24 Whitespace and Line Breaks p. 24 Optional Semicolons p. 24 Comments p. 25 Literals p. 26 Identifiers p. 26 Reserved Words p. 27 Data Types and Values p. 29 Numbers p. 30 Strings p. 33 Boolean Values p. 36 Functions p. 37 Objects p. 39 Arrays p. 40 null p. 42 undefined p. 42 The Date Object p. 43 Regular Expressions p. 43 Error Objects p. 44 Primitive Data Type Wrapper Objects p. 44 Variables p. 46 Variable Typing p. 46 Variable Declaration p. 47 Variable Scope p. 48 Primitive Types and Reference Types p. 50 Garbage Collection p. 52
Variables as Properties p. 53 Variable Scope Revisited p. 54 Expressions and Operators p. 56 Expressions p. 56 Operator Overview p. 57 Arithmetic Operators p. 60 Equality Operators p. 62 Relational Operators p. 65 String Operators p. 67 Logical Operators p. 68 Bitwise Operators p. 70 Assignment Operators p. 72 Miscellaneous Operators p. 73 Statements p. 79 Expression Statements p. 79 Compound Statements p. 80 if p. 81 else if p. 82 switch p. 83 while p. 86 do/while p. 87 for p. 87 for/in p. 89 Labels p. 90 break p. 90 continue p. 92 var p. 93 function p. 93 return p. 95 throw p. 95 try/catch/finally p. 96 with p. 98 The Empty Statement p. 99 Summary of JavaScript Statements p. 100 Functions p. 102 Defining and Invoking Functions p. 102 Functions as Data p. 106 Function Scope: The Call Object p. 108 Function Arguments: The Arguments Object p. 109 Function Properties and Methods p. 111 Objects p. 114
Objects and Properties p. 114 Constructors p. 116 Methods p. 117 Prototypes and Inheritance p. 120 Object-Oriented JavaScript p. 123 Objects as Associative Arrays p. 130 Object Properties and Methods p. 132 Arrays p. 138 Arrays and Array Elements p. 138 Array Methods p. 142 Pattern Matching with Regular Expressions p. 147 Defining Regular Expressions p. 147 String Methods for Pattern Matching p. 156 The RegExp Object p. 158 Further Topics in JavaScript p. 161 Data Type Conversion p. 161 By Value Versus by Reference p. 166 Garbage Collection p. 171 Lexical Scoping and Nested Functions p. 173 The Function() Constructor and Function Literals p. 175 Netscape's JavaScript 1.2 Incompatibilities p. 175 Client-Side JavaScript JavaScript in Web Browsers p. 181 The Web Browser Environment p. 181 Embedding JavaScript in HTML p. 185 Execution of JavaScript Programs p. 193 Windows and Frames p. 199 Window Overview p. 199 Simple Dialog Boxes p. 201 The Status Line p. 203 Timeouts and Intervals p. 204 Error Handling p. 206 The Navigator Object p. 207 The Screen Object p. 209 Window Control Methods p. 209 The Location Object p. 213 The History Object p. 215 Multiple Windows and Frames p. 218 The Document Object p. 225 Document Overview p. 225 Dynamically Generated Documents p. 230
Document Color Properties p. 235 Document Information Properties p. 235 Forms p. 236 Images p. 236 Links p. 243 Anchors p. 245 Applets p. 247 Embedded Data p. 248 Forms and Form Elements p. 249 The Form Object p. 250 Defining Form Elements p. 251 Scripting Form Elements p. 255 Form Verification Example p. 263 Scripting Cookies p. 266 An Overview of Cookies p. 266 Storing Cookies p. 268 Reading Cookies p. 269 Cookie Example p. 270 The Document Object Model p. 274 An Overview of the DOM p. 274 Using the Core DOM API p. 285 DOM Compatibility with Internet Explorer 4 p. 303 DOM Compatibility with Netscape 4 p. 305 Convenience Methods: The Traversal and Range APIs p. 306 Cascading Style Sheets and Dynamic HTML p. 314 Styles and Style Sheets with CSS p. 315 Element Positioning with CSS p. 322 Scripting Styles p. 332 DHTML in Fourth-Generation Browsers p. 341 Other DOM APIs for Styles and Style Sheets p. 345 Events and Event Handling p. 351 Basic Event Handling p. 352 Advanced Event Handling with DOM Level 2 p. 361 The Internet Explorer Event Model p. 376 The Netscape 4 Event Model p. 382 Compatibility Techniques p. 387 Platform and Browser Compatibility p. 387 Language Version Compatibility p. 392 Compatibility with Non-JavaScript Browsers p. 396 JavaScript Security p. 399 JavaScript and Security p. 399
Restricted Features p. 400 The Same-Origin Policy p. 402 Security Zones and Signed Scripts p. 403 Using Java with JavaScript p. 405 Scripting Java Applets p. 405 Using JavaScript from Java p. 407 Using Java Classes Directly p. 411 LiveConnect Data Types p. 413 LiveConnect Data Conversion p. 418 JavaScript Conversion of JavaObjects p. 421 Java-to-JavaScript Data Conversion p. 423 Core JavaScript Reference Core JavaScript Reference p. 427 Client-Side JavaScript Reference Client-Side JavaScript Reference p. 541 W3C DOM Reference W3C DOM Reference p. 685 Class, Property, Method, and Event Handler Index Class, Property, Method, and Event Handler Index p. 857 Index p. 871 Table of Contents provided by Blackwell's Book Services and R.R. Bowker. Used with permission.