List of Examples

Chapter 1: Getting Started

Example 1.1: HTML and Program Code

Chapter 2: Understanding Types, Variables, and Statements

Example 2.1: Concatenating Variables and Displaying the Value Contained
Example 2.2: Displaying a String Containing Escaped Quotations
Example 2.3: Embedding HTML in a JavaScript String
Example 2.4: Styles of JavaScript Comments
Example 2.5: Working with the Increment Operator

Chapter 3: Using Conditional Statements

Example 3.1: HTML with Form Elements
Example 3.2: Using a Conditional Expression in an onClick Event
Example 3.3: HTML Form with onClick Code
Example 3.4: Determining Whether Lowercase or Uppercase Strings Are “More Equal” Using an If Statement
Example 3.5: The Rock, Scissors, and Paper User Interface
Example 3.6: Placement of Code in Rock, Scissors, and Paper
Example 3.7: The whoWon Function
Example 3.8: Rock, Scissors, and Paper—the JavaScript Way
Example 3.9: A Simple Switch Statement Demonstration
Example 3.10: The whoWon Function with Top-Level If Statements Replaced by a Single Switch Case Statement

Chapter 4: Working with Loops

Example 4.1: Using a for Loop to Reverse a String
Example 4.2: A While Loop That Decrements from 10 to 1
Example 4.3: Using a Do/While Loop to Reverse a Text String
Example 4.4: Drawing a Christmas Tree Using Nested For Loops

Chapter 5: Understanding Functions

Example 5.1: The Function That Wraps Document.Write, Adding a Line Break
Example 5.2: A Function That Returns the Sum of Three Numbers (Stripped-Down Version)
Example 5.3: The Function That Returns the Sum of Three Numbers Including Table Codes
Example 5.4: Adding Numbers Within a Function Using the Function’s Arguments Array
Example 5.5: Using the addNums Function to Add Four Numbers from an HTML Form (and Display the Results)
Example 5.6: Calculating a Fibonacci Number Recursively
Example 5.7: Counting Rabbits (Calculating the Fibonacci Series Using a Recursive Function)
Example 5.8: Working with the Alert, Confirm, and Prompt Methods

Chapter 6: Programming with Arrays

Example 6.1: Reading and Writing Array Elements
Example 6.2: Iterating Through a Sparse Array
Example 6.3: Using Functions to Iterate Through an Array
Example 6.4: Simple Stack Example
Example 6.5: The HTML for the Stack Application
Example 6.6: Showing the Stack
Example 6.7: Popping the Stack
Example 6.8: Pushing, Popping, and Displaying the Contents of a Stack
Example 6.9: Two-Dimensional Array Work Around
Example 6.10: Reversing, Sorting, and Concatenating an Array
Example 6.11: Custom Numeric Comparison for the Array.Sort Method
Example 6.12: Case-Insensitive Comparison for the Array.Sort Method
Example 6.13: Adding 100 Check Boxes to an HTML Page
Example 6.14: Using the HTML Form Elements Array

Chapter 7: Working with Objects

Example 7.1: Using the String Object’s Length and the Document.Location Properties
Example 7.2: Using the window.close() Method to Close a Browser Window
Example 7.3: Codependent Link Tag and the onMouseOver Event
Example 7.4: Displaying the Associative Properties Area of a Window Object
Example 7.5: A General Function for Displaying an Object’s Associative Array
Example 7.6: Displaying the Navigator’s Associative Array
Example 7.7: Creating an Object and Using Object Instance Properties and Methods
Example 7.8: The Associative Array of a Rectangle Object Instance
Example 7.10: Implementing a toString Method
Example 7.10: The Bid Object Constructor and Prototype
Example 7.11: The Auction Prototype Object
Example 7.12: The Tchatshke Gulch HTML Form (Table Tags Omitted)
Example 7.13: Tchatshke Gulch (a Program for Implementing an Auction)

Chapter 8: Understanding Events and Event-Driven Programming

Example 8.1: Intercepting an onKeyDown event, Displaying the Key Pressed, and Taking Action If It’s a Specific Key
Example 8.2: Using the onSubmit Event to Cancel a Form Submission (Internet Explorer)
Example 8.3: Canceling a “Form” Submission (All Browsers)
Example 8.4: Tracking Text Box Events Using an Event Monitor
Example 8.5: Firing the onSame Event
Example 8.6: Using a Timer

Chapter 9: Manipulating Strings

Example 9.1: Using the String Object’s Link Method
Example 9.2: Converting Strings to Upper Case
Example 9.3: The HTML User Interface for the Playing with Strings Application (Including onClick Event Handlers)
Example 9.7: Playing with Strings
Example 9.4: Capitalizing the First Letter in Each Word of a String
Example 9.5: Counting the Words in a Text String
Example 9.6: Reversing a String
Example 9.8: Using a Regular Expression to Match a Date Format
Example 9.9: Trimming a String Using Regular Expressions

Chapter 10: Debugging and Exceptions

Example 10.1: Dividing by Zero
Example 10.2: Counting Words in a String (Okay Version)
Example 10.3: Counting Words in a String (“Broken” Version)
Example 10.4: Broken Word Counting Function with Diagnostic alert Statement
Example 10.5: Counting Words in a String with Diagnostic Separate Window Display
Example 10.6: Catching the “Object Expected” Error
Example 10.7: Throwing an Error
Example 10.8: Catching an Error

Chapter 11: Programming with JavaScript

Example 11.1: Password Protecting a Page
Example 11.2: Creating a Rollover Effect
Example 11.3: Creating a Slide Show Using a Random Number Generator

Learn How to Program Using Any Web Browser
Learn How to Program Using Any Web Browser
ISBN: 1590591135
EAN: 2147483647
Year: 2006
Pages: 115
Authors: Harold Davis

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: