You are previewing JavaScript Step by Step.
O'Reilly logo
JavaScript Step by Step

Book Description

Your hands-on guide to JavaScript fundamentals

Expand your expertise—and teach yourself the fundamentals of JavaScript. If you have previous programming experience but are new to JavaScript, this tutorial delivers the step-by-step guidance and coding exercises you need to master core topics and techniques.

Discover how to:

  • Work with JavaScript syntax, variables, and data types

  • Master techniques for building cross-browser programs

  • Speed up and simplify app development with jQuery

  • Quickly retrieve data from a server using AJAX requests

  • Adapt your app for mobile devices with jQuery Mobile

  • Build Windows 8 apps using HTML, CSS, and JavaScript

  • Table of Contents

    1. Dedication
    2. Special Upgrade Offer
    3. A Note Regarding Supplemental Files
    4. 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 & Book Support
      9. We Want to Hear from You
      10. Stay in Touch
    5. 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.0
          2. And then came ECMAScript
          3. So many standards...
          4. The DOM
        2. What’s in a JavaScript program?
        3. JavaScript placement on your webpage
        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. And then came Windows 8
        8. Exercises
      2. 2. Developing in JavaScript
        1. JavaScript development options
        2. Configuring your environment
        3. Writing JavaScript with Visual Studio 2012
          1. Your first web (and JavaScript) project with Visual Studio 2012
          2. Using external JavaScript files with Visual Studio 2012
        4. Debugging JavaScript
        5. 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. JavaScript’s strict mode
        6. Exercises
      4. 4. Working with variables and data types
        1. Data types in JavaScript
          1. Working with numbers
            1. Numeric functions
            2. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>Math</em></span> object object
          2. Working with strings
            1. Escaping quotation marks
            2. Other escape characters
            3. String methods and properties
          3. Booleans
          4. Objects
          5. Arrays
        2. Defining and using variables
          1. Declaring variables
          2. Variable types
          3. Variable scope
          4. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>Date</em></span> object object
        3. Using the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>RegExp</em></span> object object
          1. The syntax of regular expressions
          2. References and garbage collection
        4. Learning about type conversions
          1. Number conversions
          2. String conversions
          3. Boolean conversions
        5. 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 <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>in</em></span> operator operator
          2. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>instanceof</em></span> operator 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. Negating with <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>bitwise not</em></span> and and <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>logical not</em></span>
          5. Using the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>delete</em></span> operator operator
          6. Returning variable types with the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>typeof</em></span> operator operator
        8. Assignment operators
          1. The importance of byte conservation (a.k.a. minification)
        9. The comma operator
        10. Exercises
      6. 6. Controlling flow with conditionals and loops
        1. <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>If</em></span> (and how) (and how)
          1. Syntax for <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>if</em></span> statements statements
          2. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>prompt()</em></span> function in Internet Explorer function in Internet Explorer
          3. Compound conditions
        2. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>else if</em></span> and and <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>else</em></span> statements statements
        3. Working with ternary conditionals
        4. Testing with <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>switch</em></span>
        5. Looping with <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>while</em></span>
          1. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>while</em></span> statement statement
            1. Making sure the code executes at least once
            2. Changing the condition
          2. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>do...while</em></span> statement statement
        6. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>for</em></span> loops loops
          1. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>for</em></span> loop loop
          2. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>for...in</em></span> loop loop
          3. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>for each...in</em></span> loop loop
        7. Validating forms with conditionals
        8. Exercises
      7. 7. Working with functions
        1. What’s in a function?
          1. Function parameters
          2. Variable scoping revisited
          3. Return values
          4. More on calling functions
          5. Anonymous/unnamed functions (function literals)
          6. Closures
        2. Methods
        3. A look at dialog functions
        4. Exercises
      8. 8. Objects in JavaScript
        1. Object-oriented development
          1. Objects
          2. Properties
          3. Methods
          4. Classes
        2. Creating objects
          1. Adding properties to objects
            1. Displaying object properties
            2. Looking for a property
          2. Adding methods to objects
        3. Finding out more about arrays
          1. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>length</em></span> property property
          2. Array methods
            1. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>concat()</em></span> to add elements to add elements
            2. Joining and concatenating with <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>join</em></span>
            3. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>push</em></span> and and <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>pop</em></span> to add and remove elements to add and remove elements
            4. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>shift</em></span> and and <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>unshift</em></span> to add and remove elements to add and remove elements
            5. Using <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>slice()</em></span> to return parts of an array to return parts of an array
            6. Sorting elements with <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>sort()</em></span>
            7. Iterating through arrays
        4. Taking advantage of built-in objects
          1. Making URIs safe
          2. Using the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>eval()</em></span> method method
        5. Exercises
      9. 9. The Browser Object Model
        1. Introducing the browser
          1. The browser hierarchy
          2. Events
        2. A sense of <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>self</em></span>
        3. Getting information about the screen
        4. Using the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>navigator</em></span> object object
        5. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>location</em></span> object object
        6. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>history</em></span> object object
        7. Exercises
      10. 10. An introduction to JavaScript libraries and frameworks
        1. Understanding programming libraries
        2. Defining your own JavaScript library
        3. Looking at popular JavaScript libraries and frameworks
          1. jQuery
          2. Modernizr
          3. Yahoo! User Interface
          4. MooTools
          5. Other libraries
        4. Exercises
      11. 11. An introduction to jQuery
        1. jQuery primer
        2. Using jQuery
          1. The two jQuery downloads
          2. Including jQuery
          3. Basic jQuery syntax
          4. Connecting jQuery to the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>load</em></span> event event
        3. Using selectors
          1. Selecting elements by ID
          2. Selecting elements by class
          3. Selecting elements by type
          4. Selecting elements by hierarchy
          5. Selecting elements by position
          6. Selecting elements by attribute
          7. Selecting form elements
          8. More selectors
        4. Functions
          1. Traversing the DOM
          2. Working with attributes
          3. Changing text and HTML
          4. Inserting elements
          5. Callback functions
        5. More jQuery
        6. Exercises
    6. II. Integrating JavaScript into Design
      1. 12. The Document Object Model
        1. The Document Object Model defined
          1. DOM Level 0: The legacy DOM
          2. DOM Levels 1 through 3
          3. The DOM as a tree
          4. Working with nodes
        2. Retrieving elements
          1. Retrieving elements by ID
          2. Retrieving by tag name
          3. HTML collections
          4. Working with siblings
        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
      2. 13. JavaScript events and the browser
        1. Understanding window events
          1. The event models
            1. Using the DOM 0 model
            2. Newer event models: W3C and Internet Explorer
          2. A generic event handler
          3. jQuery event handling
          4. Binding and unbinding
        2. Detecting visitor information
          1. A brief look at the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>userAgent</em></span> property property
          2. Feature testing
          3. Keeping JavaScript away from older browsers
          4. Other <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>navigator</em></span> properties and methods properties and methods
        3. Opening, closing, and resizing windows
          1. Window opening best practices
          2. Opening tabs: no JavaScript necessary
          3. Resizing and moving windows
        4. Timers
        5. Events
          1. Mouse events and hover
          2. Many more event handlers
        6. Exercises
      3. 14. Working with images in JavaScript
        1. Working with image hovers
          1. A simple hover
          2. Modern hovers with jQuery
          3. A closer look at the exercise
        2. Preloading images
        3. Working with slide shows
          1. Creating a slide show
          2. Moving backward
          3. A jQuery slide show
        4. Working with image maps
        5. Exercises
      4. 15. Using JavaScript with web forms
        1. JavaScript and web forms
          1. Validation with JavaScript
          2. Validation with jQuery
        2. Working with form information
          1. Working with select boxes
          2. Working with check boxes
          3. Working with radio buttons
        3. Pre-validating form data
          1. Hacking JavaScript validation
          2. Validating a text field
        4. Exercises
      5. 16. JavaScript and CSS
        1. What is CSS?
          1. Using 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. Setting CSS classes with JavaScript
          4. Retrieving element styles with JavaScript
        3. Exercises
      6. 17. jQuery effects and plug-ins
        1. Installing jQuery UI
          1. Obtaining jQuery UI
          2. Installing jQuery UI
          3. Building a jQuery UI demonstration page
        2. Creating a jQuery UI calendar
          1. Customizing the calendar
            1. Adding buttons
            2. Displaying multiple months
            3. Adding month and year drop-down lists
            4. Limiting the date range
        3. Adding a dialog box
          1. Creating a modal dialog
          2. Adding buttons
        4. More JQuery UI
        5. Exercises
      7. 18. Mobile development with jQuery Mobile
        1. A walkthrough of jQuery Mobile
        2. Getting jQuery Mobile
          1. Downloading jQuery Mobile
          2. Testing jQuery Mobile
        3. Linking with jQuery Mobile
          1. Creating a link
          2. Changing the page transition
          3. Linking without AJAX
        4. Enhancing the page with toolbars
          1. Adding a navigation bar
          2. Adding a footer navigation bar
          3. Adding buttons to toolbars
          4. Other toolbar enhancements
            1. Changing the toolbar color
            2. Persistent toolbar
        5. Even more jQuery Mobile
        6. Exercises
      8. 19. Getting data into JavaScript
        1. JavaScript application architecture
          1. The big three: display, behavior, data
            1. Display: page layout
            2. Behavior: controlling what happens when
            3. Data: consume, display, and validate
        2. JavaScript and web interfaces
        3. Introduction to AJAX
        4. AJAX with jQuery
        5. AJAX without the X
        6. What’s Next?
    7. III. AJAX and Server-Side Integration
      1. 20. Using AJAX
        1. The <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>XMLHttpRequest</em></span> object object
          1. Instantiating the <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>XMLHttpRequest</em></span> object 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 <span xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg" class="emphasis"><em>POST</em></span> method method
        2. AJAX and jQuery
          1. AJAX errors and time-outs
          2. Sending data to the server
          3. Other important options
        3. Exercise
      2. 21. Developing for Windows 8
        1. Windows 8 apps
        2. Developing Windows 8 apps
          1. Development guidelines
          2. The development process
            1. Planning and designing the app
            2. Developing the app
            3. Packaging and testing the app
        3. Distributing Windows apps
          1. Distributing in the Windows Store
          2. Distributing in an enterprise
        4. Summary
    8. IV. JavaScript and Windows 8
      1. 22. Using Visual Studio for Windows 8 development
        1. Installing Visual Studio 2012
        2. Installing Visual Studio 2012 Express for Windows 8
        3. Windows 8 app templates
          1. Blank App template
          2. Grid App template
          3. Split App template
        4. Setting app details in the App Manifest
        5. Packaging apps for the Windows Store
          1. Certification requirements
            1. How do I make money?
          2. The technical process
        6. Exercises
      2. 23. Creating a Windows app
        1. The app development process
        2. Starting the app design and programming
        3. Customizing the app
          1. Customize the JavaScript
          2. Customize the main HTML
          3. Customize the detail HTML
          4. Customize the CSS
          5. Finalizing the app
        4. Customizing the Package Manifest
          1. Adding a splash screen, logo, and tile image
          2. Defining capabilities
        5. Testing the app
        6. Summary
    9. 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
      20. Chapter 20
      21. Chapter 21
      22. Chapter 22
      23. Chapter 23
    10. B. Writing JavaScript with other tools
      1. Writing JavaScript with Eclipse
        1. Your first web (and JavaScript) project with Eclipse
        2. Using external JavaScript files with Eclipse
      2. Writing JavaScript without an IDE
        1. Your first web (and JavaScript) project with Notepad
        2. Using external JavaScript files without an IDE
    11. C. About the Author
    12. Index
    13. About the Author
    14. Special Upgrade Offer
    15. Copyright