About the Book
Special Edition Using
JavaScript covers the following topics:
-
An Overview of JavaScript
-
Programming Fundamentals
-
Basic Objects
-
Working with Browser Windows
-
Working with the Document Object
-
Working with Forms
-
Dynamic HTML
Related
Books
Special Edition Using Books (Special
Edition Using Books)
Table ofContents
Introduction.
What You Need to Know.
How the Book Is Structured.
Where's the Code?
Conventions Used in This Book.
I. GETTING STARTED WITH JAVASCRIPT.
1. An Overview of JavaScript.
JavaScript: Controlling the Machine.
What Is a Programming Language?
Is JavaScript Hard to Learn?
What Can You Do with JavaScript?
What Can't You Do with JavaScript?
Cross-Browser Concerns.
2. Creating Your First Scripts.
What Do You Need to Get Started?
Basic Script Construction.
More JavaScript Examples.
Adding Comments to Your Code.
Creating External JavaScript Files.
Debugging and Troubleshooting Script
Problems.
II. PROGRAMMING FUNDAMENTALS.
3. Understanding Variables.
What Is a Variable?
Naming Variables: Rules and Best Practices.
Understanding Literal Data Types.
4. Working with Functions.
What Is a Function?
The Structure of a Function.
Where Do You Put a Function?
Using a Function.
Passing Values to Functions.
Returning a Value from a Function.
Understanding Local Versus Global
Variables.
Using Recursive Functions.
Debugging and Troubleshooting Script
Problems.
5. Building JavaScript Expressions.
What Is an Expression?
Understanding Expression Structure.
Building Numeric Expressions.
Building String Expressions.
Building Comparison Expressions.
Building Logical Expressions.
Understanding Operator Precedence.
6. Controlling Your Code I: Testing.
Using if() to Make True/False Decisions.
Using if()…else to Handle a false
Result.
Making Multiple Decisions.
Debugging and Troubleshooting Script
Problems.
7. Controlling Your Code II: Looping.
What Is Looping and Why Does Your
Code Need It?
Using while() Loops.
Using for() Loops.
Using do…while() Loops.
Controlling Loop Execution: break
and continue.
Debugging and Troubleshooting Script
Problems.
8. Working with Objects.
What Is an Object?
The JavaScript Object Hierarchy.
Manipulating Object Properties.
Working with Object Methods.
Using with() to Shorten Object Expressions.
9. Handling Events.
Understanding Events.
Constructing Event Handlers.
Using the JavaScript Events.
Debugging and Troubleshooting Script
Problems.
10. Working with Arrays.
What Is an Array?
Declaring an Array.
Populating an Array with Data.
Using the Array Object.
Debugging and Troubleshooting Script
Problems.
11. Interacting with the User.
Why Interact at All?
Displaying Messages Using the alert()
Method.
Asking Questions Using the confirm()
Method.
Getting Input Using the prompt() Method.
Debugging and Troubleshooting Script
Problems.
12. Debugging Your Code.
What Is a Bug?
Understanding the Various Types of
Errors.
A Debugging Strategy.
The Top 10 Most Common JavaScript
Error Messages.
13. Dealing with Dates and Times:
The Date Object.
Understanding JavaScript Dates.
Arguments Used with the Date Object.
Working with the Date Object.
Extracting Information About a Date.
Setting the Date.
Performing Date Calculations.
Other Date Object Methods.
14. Working with Numbers: The Math
Object.
How JavaScript Handles Numbers.
Converting Between Strings and Numbers.
The Math Object.
Properties of the Math Object.
Methods of the Math Object.
15. Manipulating Text: The String
Object.
Strings and the String Object.
Determining the Length of a String.
String Object Methods.
Programming a Library of CommonString
Functions.
16. Controlling the Browser: The
Navigator Object.
About the Navigator Object.
Determining the User's Browser Information.
IV. WORKING WITH BROWSER WINDOWS.
17. Understanding the Window Object.
Revisiting the Window Object Hierarchy.
Referencing the Window Object.
Window Dimensions and the Screen Object.
Displaying Messages In the Status
Bar.
Working with JavaScript Timeouts and
Intervals.
18. Opening, Moving, and Sizing
Windows.
Opening a Window.
Closing a Window.
Moving a Window.
Resizing a Window.
19. JavaScript Surfing: The Location
and History Objects.
Surfing Under Script Control.
Using the Location Property to Change
the Displayed Page.
Programmed Surfing with the History
Object.
20. Manipulating Frames.
Understanding Frame References.
Programming Frames.
21. JavaScript Project: Setting
Up a Password-Protected Page.
Web Page Security Issues.
A First Attempt at Password Protection.
The First Real Solution: A Trick for
Hiding the Password.
Solving the “404 Not Found” Problem.
Handling Multiple Users and Passwords.
Debugging and Troubleshooting Script
Problems.
V. WORKING WITH THE DOCUMENT OBJECT.
22. Understanding the Document Object.
Structure of the Document Object.
Properties of the Document Object.
Changing Document Colors.
Methods of the Document Object.
Writing Data to the Page.
23. Programming Links and Anchors.
Working with the Link Object.
Working with the Anchor Object.
24. Working with Images and Mouseovers.
Working with the Image Object.
Creating Mouseover Effects.
25. Creating and Using Cookies.
Saving State: The Need for Truly Global
Variables.
Setting Cookie Data.
Advanced Cookie Operations.
Debugging and Troubleshooting Script
Problems.
26. JavaScript Project: Creating
a Navigation Tree.
The Need for Navigation.
Stage 1: Designing and Creating the
Menu Objects.
Stage 2: Writing a Basic Menu.
Stage 3: Expanding and Collapsing
the Menu Items.
Stage 4: Adding Graphics and Other
Interface Enhancements.
VI. WORKING WITH FORMS.
27. Understanding the Form Object.
Structure of the Form Object.
Understanding Form Fields.
Programming Buttons.
28. Programming Form Fields.
Now For Some Real Form Programming.
Programming Text Fields.
Programming Checkboxes.
Programming Radio Buttons.
Programming Selection Lists.
29. Performing Form Validation.
The Need for Browser-Based Validation.
Displaying the Form Data for Confirmation.
Making Form Fields Mandatory.
Validating the Field Data Type.
Checking for Invalid Data.
30. JavaScript Project: Creating
a Shopping Cart.
Making the Move to E-Commerce.
Creating the Project Data.
An Overview of the Project.
Setting Up Your Store.
Understanding the Shopping Cart.
Understanding the Personal Details
Page.
Understanding the Credit Card Details
Page.
VII. WORKING WITH DYNAMIC HTML.
31. A Brief Overview of Dynamic
HTML.
The Need for Truly Dynamic Pages.
Dynamic HTML: Scripting for Control
Freaks.
DHTML Today: A Mess!
The Big DHTML Picture.
An Introduction to the Document Object
Model.
The DOM: A Hierarchy of Nodes.
32. Version 5 DHTML: The W3C's Document
Object Model.
Dealing with Nodes in the DOM.
Changing the Structure of the Document
Hierarchy.
33. Version 4 DHTML: Proprietary
Object Models.
The Pre-DOM Dark Ages.
The Internet Explorer 4 DHTML Document
Object Model.
The Netscape Navigator 4 Document
Object Model.
34. Cross-Browser Solutions: Detection
and Generic Functions.
Cross-Browser Issues.
Detecting the User's Browser.
Creating a Custom Object Front-End.
35. Cross-Browser DHTML Examples.
Some Notes Before We Begin.
Cross-Browser DHTML Text Examples.
Cross-Browser DHTML Image Examples.
VIII. APPENDIXES.
Appendix A: JavaScript Tools for
Debugging Scripts.
Using the Microsoft Script Debugger.
Using Netscape's JavaScript Debugger.
Appendix B: JavaScript Reserved
Words and Keywords.
JavaScript Reserved Words.
JavaScript Keywords.
Appendix C: Working with Regular
Expressions.
Pattern Matching the String Object
Way.
Pattern Matching the Regular Expression
Way.
Using Regular Expressions in Your
JavaScript Code.
Index. |