Microsoft® Start Here!™ Learn JavaScript

Book description

Ready to learn JavaScript? Start Here!

Learn the fundamentals of modern programming with JavaScript—and begin building your first apps for the web. If you have no previous experience with JavaScript, no problem—simply start here! This book introduces must-know concepts and techniques through easy-to-follow explanations, examples, and exercises.

Here’s where you start learning JavaScript

  • Learn the basics of JavaScript programming

  • Find out how to access browser content from JavaScript

  • Manage images and validate form entries

  • Retrieve data using the JavaScript Object Notation (JSON)

  • Use JavaScript and HTML5 in Windows 8 applications

  • Put it all together by creating your first programs

  • Table of contents

    1. Dedication
    2. Introduction
      1. Who Should Read This Book
        1. Assumptions
      2. Who Should Not Read This Book
      3. Organization of This Book
      4. Conventions and Features in This Book
      5. System Requirements
      6. Code Samples
        1. Installing the Code Samples
        2. Using the Code Samples
      7. Acknowledgments
      8. Errata and Book Support
      9. We Want to Hear from You
      10. Stay in Touch
    3. 1. What Is JavaScript?
      1. A First JavaScript Program
      2. Where JavaScript Fits
        1. HTML, CSS, and JavaScript
          1. HTML
          2. CSS
          3. JavaScript
        2. JavaScript in Windows 8
        3. Placing JavaScript in a Webpage
          1. No JavaScript? No Problem.
      3. Writing Your First JavaScript Program
        1. Writing JavaScript in Visual Studio 11
        2. JavaScript’s Limitations
          1. Don’t Rely on JavaScript for Data Security
          2. You Can’t Force JavaScript on Clients
      4. Summary
    4. 2. JavaScript Programming Basics
      1. JavaScript Placement: Revisited
      2. Basic JavaScript Syntax
        1. JavaScript Statements and Expressions
        2. Names and Reserved Words
        3. Spacing and Line Breaks
        4. Comments
        5. Case Sensitivity
        6. Operators
      3. JavaScript Variables and Data Types
        1. Variables
        2. Data Types
          1. Numbers
          2. Strings
          3. Booleans
          4. Null
          5. Undefined
      4. Looping and Conditionals in JavaScript
        1. Loops in JavaScript
        2. Conditionals in JavaScript
          1. A Conditional Example
      5. Summary
    5. 3. Building JavaScript Programs
      1. Functions
        1. Function Overview
        2. Function Arguments
        3. Calling Functions
        4. Return Values
        5. Function Examples
          1. A Simple Example
          2. Refactoring addNumbers()
        6. Scoping Revisited
      2. Objects in JavaScript
        1. What Does an Object Look Like?
        2. Properties
        3. Methods
          1. Using the this Keyword
        4. Object Enumeration
        5. Classes
      3. Debugging JavaScript
        1. Debugging as a Process
        2. Debugging in Internet Explorer
      4. Summary
    6. 4. JavaScript in a Web Browser
      1. JavaScript Libraries
      2. Getting jQuery
        1. Using a Local Copy of jQuery
        2. Using a CDN-Hosted jQuery Library
        3. Testing jQuery
      3. Getting jQuery UI
        1. Adding jQuery UI to a Project
        2. Testing jQuery UI
      4. The Browser Object Model
        1. Events and the window Object
        2. The screen Object
        3. The navigator Object
        4. The location Object
      5. The DOM
        1. DOM Versions
        2. The DOM Tree
      6. Retrieving Elements with JavaScript and jQuery
        1. Using jQuery, Briefly
          1. The ready() Function
          2. jQuery Selectors
        2. Retrieving Elements by ID
        3. Retrieving Elements by Class
        4. Retrieving Elements by HTML Tag Name
      7. Summary
    7. 5. Handling Events with JavaScript
      1. Common Events with JavaScript
      2. Handling Mouse Events
        1. Preventing the Default Action
        2. Attaching to an Element with On
      3. Validating Web Forms with jQuery
        1. Validating on Submit
        2. Regular Expressions
          1. Other Common Matches
        3. Finding the Selected Radio Button or Check Box
          1. Validating Radio Buttons and Check Boxes
        4. Determining the Selected Drop-Down Element
          1. Validating <select> Elements
          2. Wrapping Up Form Validation
        5. The click Event Revisited
      4. Keyboard Events and Forms
      5. Summary
    8. 6. Getting Data into JavaScript
      1. AJAX in Brief
        1. On Servers, GETs, and POSTs
        2. Building a Server Program
          1. PHP Example
      2. AJAX and JavaScript
      3. Retrieving Data with jQuery
        1. Using get() and post()
          1. Using the get() and post() Functions
          2. Sending Data in the Request
        2. Building an Interactive Page
        3. Error Handling
          1. Chaining an Error Handler
      4. Using JSON for Efficient Data Exchange
        1. Using getJSON()
      5. Sending Data to the Server
        1. Sending Data with getJSON
        2. Sending Post Data
      6. Summary
    9. 7. Styling with JavaScript
      1. Changing Styles with JavaScript
        1. CSS Revisited
        2. Changing CSS Properties
      2. Working with CSS Classes
        1. Determining Classes with hasClass()
        2. Adding and Removing Classes
          1. Adding Error Styling to a Form
      3. Advanced Effects with jQuery UI
        1. Using Effects to Enhance a Web Application
        2. Using jQuery UI Widgets
          1. Building a Slider
          2. Creating a Calendar
        3. Other Helpful jQuery UI Widgets
      4. Putting It All Together: A Space Travel Demo
        1. Code Analysis
          1. Code Analysis
      5. Summary
    10. 8. Using JavaScript with Microsoft Windows 8
      1. JavaScript Is Prominent in Windows 8
      2. A Stroll Through a Windows 8 Application
        1. Quick Checkpoint: Windows 8 Apps
          1. Quick Checkpoint: Windows 8 Apps
      3. Building a Windows 8 App
        1. Building the Application
        2. Code Analysis
        3. Defining a Splash Screen, Logos, and a Tile
      4. Summary
    11. Index
    12. About the Author
    13. Copyright

    Product information

    • Title: Microsoft® Start Here!™ Learn JavaScript
    • Author(s): Steve Suehring
    • Release date: September 2012
    • Publisher(s): Microsoft Press
    • ISBN: 9780735667334