JavaScript Step by Step

Book description

Get the hands-on, step-by-step guide to learning JavaScript for Web development. Even with no programming experience, you can teach yourself the essentials of working with the JavaScript programming language one step at a time. With STEP BY STEP, you work at your own pace through hands-on, learn-by-doing exercises. Whether you re building skills for your career or just want to customize your personal Web site, you ll learn the core capabilities and fundamental techniques for working with JavaScript and begin to create professional-looking Web sites. Includes a companion CD with code samples, data sets, and a fully searchable eBook.

Key Book Benefits

Features easy-to-follow, logically planned lessons to help you learn at your own pace

Delivers a solid understanding of how to use JavaScript to build custom Web sites

Includes a companion CD with code samples, data sets, and a fully searchable eBook

Table of contents

  1. JavaScript Step by Step
  2. Dedication
  3. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  4. A Note Regarding Supplemental Files
  5. Acknowledgments
  6. Introducing JavaScript Step by Step
    1. Features and Conventions of This Book
    2. Using the Book's CD
      1. What's on the CD?
      2. Minimum System Requirements
      3. Using the Sample Files
    3. Getting Help
      1. Getting Help with This Book and Its CD
  7. I. JavaWhat? The Where, Why, and How of JavaScript
    1. 1. JavaScript Is More Than You Might Think
      1. A Brief History of JavaScript
        1. Enter Internet Explorer 3
        2. And Then Came ECMAScript
        3. So Many Standards…
        4. The DOM
      2. What's in a JavaScript Program?
      3. Placing JavaScript on Your Web Page
      4. What JavaScript Can Do
      5. What JavaScript Can't Do
        1. JavaScript Can't Be Forced on a Client
        2. JavaScript Can't Guarantee Data Security
        3. JavaScript Can't Cross Domains
        4. JavaScript Doesn't Do Servers
      6. Tips for Using JavaScript
        1. Where JavaScript Fits
        2. Which Browsers Should the Site Support?
      7. Exercises
    2. 2. Developing in JavaScript
      1. JavaScript Development Options
      2. Configuring Your Environment
      3. Writing in JavaScript with Visual Studio 2005
        1. Your First Web (and JavaScript!) Project with Visual Studio 2005
        2. Using External JavaScript Files with Visual Studio 2005
      4. Writing JavaScript with Eclipse
        1. Your First Web (and JavaScript!) Project with Eclipse
        2. Using External JavaScript Files with Eclipse
      5. Writing JavaScript Without an IDE
        1. Your First Web (and JavaScript) Project with Notepad
        2. Using External JavaScript Files Without an IDE
      6. Debugging JavaScript
      7. Exercises
    3. 3. JavaScript Syntax and Statements
      1. A Bit of Housekeeping
        1. Case Sensitivity
        2. White Space
        3. Comments
        4. Semicolons
        5. Line Breaks
        6. Placing JavaScript Correctly
      2. JavaScript Statements
        1. What's in a Statement?
        2. The Two Types of JavaScript Statements
      3. Reserved Words in JavaScript
      4. A Quick Look at Functions
      5. Exercises
    4. 4. Working with Variables and Data
      1. Data Types in JavaScript
        1. Numbers
          1. Numeric Functions
          2. The Math Object
        2. Strings
          1. Escaping Quotes
          2. Other Escape Characters
          3. String Methods and Properties
        3. Booleans
        4. Null
        5. Undefined
        6. Objects
        7. Arrays
      2. Defining and Using Variables
        1. Declaring Variables
        2. Variable Types
        3. Variable Scope
        4. References and Garbage Collection
      3. Type Conversions
        1. Number Conversions
        2. String Conversions
        3. Boolean Conversions
      4. Exercises
    5. 5. Using Operators and Expressions
      1. Meet the Operators
      2. Additive Operators
      3. Multiplicative Operators
      4. Bitwise Operators
      5. Equality Operators
      6. Relational Operators
        1. The in Operator
        2. The instanceof Operator
      7. Unary Operators
        1. Incrementing and Decrementing
        2. Converting to a Number with the Plus Sign
        3. Creating a Negative Number with the Minus Sign
        4. Bitwise Not and Logical Not
        5. The delete Operator
        6. The typeof Operator
        7. The void Operator
      8. Assignment Operators
      9. Exercises
  8. II. Applying JavaScript
    1. 6. Controlling Flow with Conditionals and Loops
      1. If (and how)
        1. Syntax for if Statements
        2. The prompt() Function in Windows Internet Explorer 7
        3. Compound Conditions
          1. Nested Conditions
      2. Else if and else Statements
      3. Multiple Levels of Conditionals
      4. Ternary Conditionals
      5. Switch
      6. Looping with while
        1. The while Statement
          1. Making Sure the Code Executes At Least Once
          2. Changing the Condition
        2. The do…while Statement
      7. Using for Loops
        1. The for Loop
        2. The for…in Loop
        3. The for each…in Loop
      8. Validating Forms with Conditionals
      9. Exercises
    2. 7. Working with Functions
      1. What's in a Function?
        1. Function Arguments
        2. Variable Scoping Revisited
        3. Return Values
        4. More on Calling Functions
        5. Unnamed Functions (Function Literals)
      2. Methods
      3. A Look at Dialog Functions
      4. Exercises
    3. 8. Objects in JavaScript
      1. Object-Oriented Development
        1. Objects
        2. Properties
        3. Methods
        4. Classes
      2. Creating Objects
        1. Adding Properties to Methods
          1. Displaying Object Properties
          2. Looking for a Property
        2. Adding Methods to Objects
      3. More About Arrays
        1. The length Property
        2. Array Methods
          1. Adding and Removing Elements
      4. Built-in Objects
        1. The Date Object
      5. Exercises
    4. 9. The Browser Object Model
      1. Introducing the Browser
        1. The Browser Hierarchy
        2. Events
      2. A Sense of Self
      3. Getting Information About the Screen
      4. Using the navigator Object
      5. The location Object
      6. The history Object
      7. Exercises
    5. 10. The Document Object Model
      1. The Document Object Model Defined
        1. DOM Level 0: The Legacy DOM
        2. DOM Levels 1 and 2
        3. The DOM as a Tree
        4. Working with Nodes
      2. Retrieving Elements
        1. Retrieving by ID
        2. Retrieving by Tag Name
      3. Working with Attributes
        1. Viewing Attributes
        2. Setting Attributes
      4. Creating Elements
        1. Adding Text
        2. Adding an Element and Setting an ID
      5. Deleting Elements
      6. Exercises
  9. III. Integrating JavaScript into Design
    1. 11. Using JavaScript with Web Forms
      1. JavaScript and Web Forms
      2. Obtaining Form Data
      3. Working with Form Information
        1. Working with Select Boxes
        2. Working with Check Boxes
        3. Working with Radio Buttons
      4. Prevalidating Form Data
        1. Hacking JavaScript Validation
        2. Validating a Text Field
      5. Exercises
    2. 12. Creating and Consuming Cookies
      1. A Look at Cookies
      2. Creating Cookies with JavaScript
        1. A Simple Cookie
        2. Setting a Cookie's Expiration Date
        3. Setting the Cookie Path
        4. Setting the Cookie Domain
        5. Working with Secure Cookies
      3. Reading Cookies with JavaScript
      4. Removing Cookies
      5. Exercises
    3. 13. Working with Images in JavaScript
      1. Working with Image Rollovers
        1. A Simple Rollover
        2. The Better Way
      2. Preloading Images
      3. Working with Slideshows
        1. Creating the Show
        2. Moving Backward
      4. Working with Image Maps
      5. Exercises
    4. 14. Browsers and JavaScript
      1. Understanding Window Events
        1. The Event Models
          1. Using the DOM 0 Model
        2. Newer Event Models: W3C and Windows Internet Explorer
        3. A Generic Event Handler
      2. Detecting Things About the Visitor
        1. A Brief Look at the userAgent Property
        2. Feature Testing
        3. Keeping JavaScript Away from Older Browsers
        4. Other navigator Properties and Methods
      3. Opening, Closing, and Resizing Windows
        1. Window Open and Close: In Action
          1. A Closer Look at the Main Form Page
          2. A Closer Look at the New Window
        2. Window Opening Best Practices
        3. No JavaScript Necessary?
        4. Resizing and Moving Windows
      4. Timers
      5. Exercises
    5. 15. JavaScript and CSS
      1. What Is CSS?
        1. Properties and Selectors
        2. Applying CSS
      2. The Relationship Between JavaScript and CSS
        1. Setting Element Styles by ID
        2. Setting Element Styles by Type
        3. Retrieving Element Styles with JavaScript
        4. Modifying Style Sheets with JavaScript
      3. Exercises
    6. 16. JavaScript Error Handling
      1. An Overview of Error Handling
      2. Using try/catch
        1. And Finally…
      3. Using the onerror Event
        1. Attaching onerror to the window Object
        2. Ignoring Errors
        3. Attaching onerror to the image Object
      4. Exercises
  10. IV. AJAX and Beyond
    1. 17. JavaScript and XML
      1. Using XML with JavaScript
        1. An Example XML Document
        2. Loading an XML Document with JavaScript
          1. Importing the Document
          2. Displaying the Document
      2. A Preview of Things to Come
      3. Exercises
    2. 18. A Touch of AJAX
      1. Introduction to AJAX
      2. The XMLHttpRequest Object
        1. Instantiating the XMLHttpRequest Object
        2. Sending an AJAX Request
        3. Processing an AJAX Response
        4. Processing XML Responses
        5. Working with JSON
        6. Processing Headers
        7. Using the POST Method
      3. Case Study: Live Searching and Updating
      4. Exercises
    3. 19. A Bit Deeper into AJAX
      1. Creating an HTML Table with XML and CSS
      2. Styling the Table with CSS
      3. Creating a Dynamic Drop-down Box
      4. Accepting Input from the User and AJAX
      5. Exercises
    4. A. Answer Key to Exercises
      1. Chapter 1
      2. Chapter 2
      3. Chapter 3
      4. Chapter 4
      5. Chapter 5
      6. Chapter 6
      7. Chapter 7
      8. Chapter 8
      9. Chapter 9
      10. Chapter 10
      11. Chapter 11
      12. Chapter 12
      13. Chapter 13
      14. Chapter 14
      15. Chapter 15
      16. Chapter 16
      17. Chapter 17
      18. Chapter 18
      19. Chapter 19
  11. Index
  12. About the Author
  13. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  14. Copyright

Product information

  • Title: JavaScript Step by Step
  • Author(s): Steve Suehring
  • Release date: February 2008
  • Publisher(s): Microsoft Press
  • ISBN: 9780735624498