| |
| |
Acknowledgments | |
| |
| |
Introduction | |
| |
| |
| |
Learn JavaScript Basics | |
| |
| |
| |
Prepare to Program in JavaScript | |
| |
| |
Learn the History of JavaScript | |
| |
| |
The Origin of JavaScript | |
| |
| |
JavaScript Makes Its Way into Internet Explorer | |
| |
| |
JavaScript Becomes an Official Standard | |
| |
| |
Where JavaScript Is Today | |
| |
| |
Choose a Development Environment | |
| |
| |
Develop JavaScript-Enabled Web Pages | |
| |
| |
Create Server-Based Web Applications | |
| |
| |
Use JavaScript in a DOS or Windows Environment | |
| |
| |
JavaScript Development Tools | |
| |
| |
Learn What JavaScript Can and Cannot Do | |
| |
| |
Use JavaScript as a Client-Side Language | |
| |
| |
Use JavaScript as a Server-Side Language | |
| |
| |
Decide Which Version of JavaScript to Use | |
| |
| |
Test JavaScript Programs Using HTML | |
| |
| |
Create a JavaScript Template | |
| |
| |
Understand the JavaScript Template | |
| |
| |
Communicate with the User | |
| |
| |
Display an Alert Message | |
| |
| |
Write Text to the Browser Window | |
| |
| |
Learn More about Topics Discussed in this Chapter | |
| |
| |
| |
Learn JavaScript Fundamentals | |
| |
| |
Understand Basic Terminology | |
| |
| |
Store Data in Variables | |
| |
| |
Define Variables | |
| |
| |
Define Constants | |
| |
| |
Understand Program Flow | |
| |
| |
Control Program Flow with Statements | |
| |
| |
Execute Code Conditionally | |
| |
| |
Repeat Statements Using Loops | |
| |
| |
Comment Your Code | |
| |
| |
Set a Default Object | |
| |
| |
Handle Errors | |
| |
| |
Understand the Basics of Expressions | |
| |
| |
Use Operators to Create Complex Expressions | |
| |
| |
Organize Your Code into Functions | |
| |
| |
Define Functions | |
| |
| |
Accept Parameters | |
| |
| |
Understand Variable Scope | |
| |
| |
Return Values | |
| |
| |
Use the Improvements in JavaScript 2.0 to Create More Powerful Functions | |
| |
| |
Use Named Optional Parameters | |
| |
| |
Accept Any Number of Parameters | |
| |
| |
| |
Use Built-in JavaScript Classes | |
| |
| |
Learn about Objects in JavaScript | |
| |
| |
Write Unstructured Programs | |
| |
| |
Organize Code into Procedures | |
| |
| |
Separate a Program into Modules | |
| |
| |
Use the Object-Oriented Approach | |
| |
| |
Turn Properties and Functions into a Class | |
| |
| |
JavaScript's Built-in Classes and Data Types | |
| |
| |
Instantiate an Object with the new Operator | |
| |
| |
Access an Object with the Operator | |
| |
| |
Access an Object with the [] Operator | |
| |
| |
Create a String Object in JavaScript | |
| |
| |
Create a String Object Using a String Literal | |
| |
| |
Create a String Object Using the String Data Type | |
| |
| |
Use the String Object's Built-in Functionality | |
| |
| |
Perform Mathematical Functions | |
| |
| |
Apply JavaScript's Date-Handling Functions | |
| |
| |
Convert Strings into Numbers | |
| |
| |
Use the parseInt and parseFloat Functions | |
| |
| |
Prepare Text Before Sending to Web Server | |
| |
| |
Use the escape and unescape Functions | |
| |
| |
Decide When to Use Regular Expressions | |
| |
| |
Understand the Basics of Regular Expressions | |
| |
| |
Create Patterns with a RegExp Object | |
| |
| |
Understand JavaScript 2.0's Powerful New Data Types | |
| |
| |
Use the Boolean, Integer, and Number Data Types | |
| |
| |
Use the char Data Type | |
| |
| |
Use the Object Data Type | |
| |
| |
Understand Special Data Types | |
| |
| |
| |
Organize Data into Arrays | |
| |
| |
Create an Array Object | |
| |
| |
Create an Empty Array | |
| |
| |
Specify an Initial Array Length | |
| |
| |
Create and Initialize an Array in One Line of Code | |
| |
| |
Use Array Literals | |
| |
| |
Call the Properties and Methods of the Array Object | |
| |
| |
Set and Retrieve Values in an Array | |
| |
| |
Use Multidimensional Arrays | |
| |
| |
Use JavaScript 2.0's Enhanced Arrays | |
| |
| |
The StaticArray Class | |
| |
| |
The DynamicArray Class | |
| |
| |
The ConstArray Class | |
| |
| |
| |
Create Your Own JavaScript Classes | |
| |
| |
Learn about Classes in JavaScript | |
| |
| |
Create Objects in JavaScript 1.x | |
| |
| |
Call a Constructor Function | |
| |
| |
Use an Object Literal | |
| |
| |
Extend an Existing Class | |
| |
| |
Extend an Existing Object | |
| |
| |
Create Objects in JavaScript 2.0 | |
| |
| |
Define Your Own Classes | |
| |
| |
Organize Classes Using Inheritance | |
| |
| |
Choose Between Static and Instance Members | |
| |
| |
Make Class Members Public or Private | |
| |
| |
| |
Build JavaScript-Enabled Web Sites | |
| |
| |
| |
Embed JavaScript in a Web Page | |
| |
| |
Understand Basic HTML Structure | |
| |
| |
Build an HTML Document | |
| |
| |
Indicate the Document Type with [left angle bracket]!DOCTYPE[right angle bracket] | |
| |
| |
Add a Title and Define Document Keywords | |
| |
| |
Format Text with HTML Elements | |
| |
| |
Format Text with Style Sheets | |
| |
| |
Use [left angle bracket]script[right angle bracket] to Add JavaScript to a Web Page | |
| |
| |
Use [left angle bracket]noscript[right angle bracket] for Browsers That Don't Support Scripting | |
| |
| |
Load an External JavaScript File | |
| |
| |
Call JavaScript Using Hyperlinks | |
| |
| |
Learn More about the Topics in this Chapter | |
| |
| |
| |
Create Scripts That Work in Every Browser | |
| |
| |
Understand Browser Differences | |
| |
| |
What Kind of Errors Can Occur? | |
| |
| |
Detect What Type of Browser the User Is Running | |
| |
| |
Query the Document Model | |
| |
| |
Stick to Web Standards | |
| |
| |
Write Cross-Browser Code | |
| |
| |
| |
Manipulate Web Forms | |
| |
| |
Understand HTML Forms | |
| |
| |
Request User Input Using an HTML Form | |
| |
| |
Process Form Input with Client-Side JavaScript | |
| |
| |
Process Form Input on a Web Server | |
| |
| |
Insert an HTML Form into a Web Page | |
| |
| |
Retrieve and Set Form Control Values in JavaScript | |
| |
| |
Access Form Values Using the forms Array | |
| |
| |
Access Form Values Using the elements Array | |
| |
| |
Access Form Values Using getElementById() | |
| |
| |
Access Form Values Using getElementsByName() | |
| |
| |
Access Form Values Using getElementsByTagName() | |
| |
| |
| |
Handle Browser Events | |
| |
| |
Write JavaScript Event Handlers | |
| |
| |
Handle User Interface Events | |
| |
| |
Handle Mouse Events | |
| |
| |
Handle Key Events | |
| |
| |
Handle HTML Events | |
| |
| |
Handle Events Using the Event Property | |
| |
| |
Trigger Events in JavaScript | |
| |
| |
Call the Method Associated with an Event | |
| |
| |
Use the fireEvent Method | |
| |
| |
Overcome Browser Incompatibility | |
| |
| |
| |
Communicate Between Browser Frames | |
| |
| |
Learn the Basics of HTML Frames | |
| |
| |
Create a Frameset in HTML | |
| |
| |
Define and Name Frames in a Frameset | |
| |
| |
Call JavaScript Functions from Other Frames | |
| |
| |
Access Another Frame Using JavaScript | |
| |
| |
Call a JavaScript Function Located in Another Frame | |
| |
| |
Handle Synchronization Between Frames | |
| |
| |
| |
Interact with the Web Browser | |
| |
| |
Learn the Basics of the Document Object Model | |
| |
| |
Manipulate the Contents of a Web Page | |
| |
| |
Dynamically Modify the Contents of a Web Page | |
| |
| |
Change the Items in a Drop-Down List Box | |
| |
| |
Examine the Entire Browser Window | |
| |
| |
Retrieve Properties of the Web Browser Software | |
| |
| |
Examine the Operating System's Display Settings | |
| |
| |
Access the Web Browser History List | |
| |
| |
Send the Browser to a New Location | |
| |
| |
| |
Perform Simple Animation | |
| |
| |
Learn the Basics of Cascading Style Sheets | |
| |
| |
Assign Style to Web Pages Using HTML Elements | |
| |
| |
Assign Style to Web Pages Using Style Sheets | |
| |
| |
Use Basic Style Attributes | |
| |
| |
Position Elements on a Web Page | |
| |
| |
Modify Styles Using JavaScript | |
| |
| |
Understand Cross-Platform Issues | |
| |
| |
Perform Basic Animation Using JavaScript | |
| |
| |
Dynamically Load Images | |
| |
| |
Make Content Move Around the Screen | |
| |
| |
| |
Take JavaScript to the Next Level | |
| |
| |
| |
Debug JavaScript Programs | |
| |
| |
Understand the Possible Causes of Errors | |
| |
| |
Find the Source of an Error Message | |
| |
| |
Interpret Error Messages | |
| |
| |
Use a JavaScript Validator | |
| |
| |
Add Debugging Code to Your Programs | |
| |
| |
Use the JavaScript Console | |
| |
| |
Use a JavaScript Debugger | |
| |
| |
| |
Make Your Program Errorproof | |
| |
| |
Learn the Basics of Exceptions | |
| |
| |
Catch Exceptions Using the try and catch Statements | |
| |
| |
Understand Exception Bubbling | |
| |
| |
Use the IE Error Object | |
| |
| |
Use Netscape-Only catch Clauses | |
| |
| |
Use Nonstandard finally Clauses | |
| |
| |
Create Exceptions Using the throw Statement | |
| |
| |
Design Programs That Are Easy to Debug from the Start | |
| |
| |
Avoid Unstructured Programming | |
| |
| |
Break Code into Manageable Chunks | |
| |
| |
Reuse Code Using Classes and Objects | |
| |
| |
Test Your JavaScript Code Thoroughly | |
| |
| |
Create a Testing Harness | |
| |
| |
Force Errors to Test Error-Handling Code | |
| |
| |
Try Your Program in Many Different Environments | |
| |
| |
| |
Use JavaScript to Manage Browser Plug-Ins | |
| |
| |
Insert Scriptable Objects into HTML Web Pages | |
| |
| |
Include Sun Java Applets | |
| |
| |
Connect to Java Applets Using JavaScript | |
| |
| |
Embed Movies and Music in Web Pages | |
| |
| |
Connect to Music and Media Objects Using JavaScript | |
| |
| |
Use the Microsoft Calendar Control in Your Web Pages | |
| |
| |
| |
HTML 4.01 Tags | |
| |
| |
| |
JavaScript Quick Reference | |
| |
| |
Index | |