Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition

Book description

Learn JavaScript in 24 Hours

Covers JavaScript 1.8+, Ajax and jQuery

In just 24 lessons of one hour or less, you can learn how to create dynamic, interactive Web pages with the popular and ubiquitous JavaScript web programming language.

Using a straightforward, step-by-step approach, each lesson in this book clearly and carefully walks you through basic concepts and techniques, and helps you learn the essentials of JavaScript programming from the ground up.

Learn how to…

  • Use JavaScript to build dynamic, interactive Web pages

  • Debug scripts

  • Create scripts that work in all browsers

  • Work with HTML5 and CSS3

  • Leverage the popular jQuery library

  • Control CSS with simple JavaScripts

  • Add Ajax effects to your web pages

  • Script animations and music

  • Step-by-step instructions carefully walk you through the most common JavaScript programming tasks

    Quizzes at end of every chapter help you build and test your knowledge

    Interactive online exercises let you practice what you learn at the Codecademy web site with no downloads or installation needed

    Sams Publishing has teamed up with Codecademy — the online place where anyone can learn and teach coding — to provide readers of Sams Teach Yoruself JavaScript in 24 Hours with an exclusive area on the Codecademy web site where you can supplement what you've learned in this book with some fun, fully interactive exercises and projects. After reading a lesson in the book you can roll up your sleeves and get some hands-on coding experience at codecademy.com/tracks/teachyourself



    Table of contents

    1. Title Page
    2. Copyright Page
    3. Contents at a Glance
    4. Table of Contents
    5. About the Authors
    6. We Want to Hear from You!
    7. Reader Services
    8. Introduction
      1. Who This Book Is For
      2. The Aims of This Book
      3. Conventions Used
      4. Q&A, Quiz, and Exercises
      5. How the Book Is Organized
      6. Tools You’ll Need
    9. Part I: First Steps with JavaScript
      1. Hour 1. Introducing JavaScript
        1. Web Scripting Fundamentals
        2. Server- Versus Client-Side Programming
        3. JavaScript in a Nutshell
        4. Where JavaScript Came From
        5. The <script> Tag
        6. Introducing the DOM
        7. Talking to the User
        8. Summary
        9. Q&A
        10. Workshop
        11. Exercises
      2. Hour 2. Writing Simple Scripts
        1. Including JavaScript in Your Web Page
        2. JavaScript Statements
        3. Variables
        4. Operators
        5. Capturing Mouse Events
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      3. Hour 3. Using Functions
        1. General Syntax
        2. Calling Functions
        3. Arguments
        4. Returning Values from Functions
        5. Scope of Variables
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      4. Hour 4. DOM Objects and Built-In Objects
        1. Interacting with the User
        2. Selecting Elements by Their id
        3. Accessing Browser History
        4. Using the location Object
        5. Browser Information—The navigator Object
        6. Dates and Times
        7. Simplifying Calculation with the Math Object
        8. Summary
        9. Q&A
        10. Workshop
        11. Exercises
      5. Hour 5. Different Types of Data
        1. Numbers
        2. Strings
        3. Boolean Values
        4. Arrays
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
    10. Part II: More Advanced JavaScript
      1. Hour 6. Scripts That Do More
        1. Conditional Statements
        2. Loops and Control Structures
        3. Debugging Your Scripts
        4. Summary
        5. Q&A
        6. Workshop
        7. Exercises
      2. Hour 7. Object Oriented Programming
        1. What Is Object Oriented Programming (OOP)?
        2. Object Creation
        3. Extending and Inheriting Objects Using prototype
        4. Encapsulation
        5. Using Feature Detection
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      3. Hour 8. Meet JSON
        1. What Is JSON?
        2. Accessing JSON Data
        3. Data Serialization with JSON
        4. JSON Data Types
        5. Simulating Associative Arrays
        6. Creating Objects with JSON
        7. JSON Security
        8. Summary
        9. Q&A
        10. Workshop
        11. Exercises
      4. Hour 9. Responding to Events
        1. Understanding Event Handlers
        2. Default Actions
        3. The event Object
        4. Cross-Browser Event Handlers
        5. Advanced Event Handler Registration
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      5. Hour 10. JavaScript and Cookies
        1. What Are Cookies?
        2. The document.cookie Property
        3. Cookie Ingredients
        4. Writing a Cookie
        5. A Function to Write a Cookie
        6. Reading a Cookie
        7. Deleting Cookies
        8. Setting Multiple Values in a Single Cookie
        9. Summary
        10. Q&A
        11. Workshop
        12. Exercises
    11. Part III: Working with the Document Object Model (DOM)
      1. Hour 11. Navigating the DOM
        1. DOM Nodes
        2. Selecting Elements with getElementsByTagName()
        3. Reading an Element’s Attributes
        4. Mozilla’s DOM Inspector
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
      2. Hour 12. Scripting the DOM
        1. Creating New Nodes
        2. Manipulating Child Nodes
        3. Editing Element Attributes
        4. Dynamically Loading JavaScript Files
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
      3. Hour 13. JavaScript and CSS
        1. A Ten Minute CSS Primer
        2. The DOM style Property
        3. Accessing Classes Using className
        4. The DOM styleSheets Object
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
      4. Hour 14. Good Coding Practice
        1. Don’t Overuse JavaScript
        2. Writing Readable and Maintainable Code
        3. Graceful Degradation
        4. Progressive Enhancement
        5. Unobtrusive JavaScript
        6. Feature Detection
        7. Handling Errors Well
        8. Summary
        9. Q&A
        10. Workshop
        11. Exercises
      5. Hour 15. Graphics and Animation
        1. Preloading Images
        2. Animating Page Elements
        3. Animating Transparency
        4. CSS3 Transitions, Transformations, and Animations
        5. Scripting DOM Positioning
        6. Optimizing Performance
        7. Summary
        8. Q&A
        9. Workshop
        10. Exercises
    12. Part IV: Ajax
      1. Hour 16. Introducing Ajax
        1. The Anatomy of Ajax
        2. The XMLHttpRequest Object
        3. Creating Instances of XMLHttpRequest
        4. Sending the Server Request
        5. Monitoring Server Status
        6. Callback Functions
        7. responseText and responseXML Properties
        8. Summary
        9. Q&A
        10. Workshop
        11. Exercises
      2. Hour 17. Creating a Simple Ajax Library
        1. An Ajax Library
        2. Implementing the Library
        3. Using the Library
        4. Summary
        5. Q&A
        6. Workshop
        7. Exercises
      3. Hour 18. Solving Ajax Problems
        1. Debugging Ajax Applications
        2. Common Ajax Errors
        3. Some Programming Gotchas
        4. Summary
        5. Q&A
        6. Workshop
        7. Exercises
    13. Part V: Using JavaScript Libraries
      1. Hour 19. Making Life Easier with Libraries
        1. Why Use a Library?
        2. What Sorts of Things Can Libraries Do?
        3. Some Popular Libraries
        4. Introducing prototype.js
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
      2. Hour 20. A Closer Look at jQuery
        1. Including jQuery in Your Pages
        2. jQuery’s $(document).ready Handler
        3. Selecting Page Elements
        4. Working with HTML Content
        5. Showing and Hiding Elements
        6. Animating Elements
        7. Command Chaining
        8. Handling Events
        9. Using jQuery to Implement Ajax
        10. Summary
        11. Q&A
        12. Workshop
        13. Exercises
      3. Hour 21. The jQuery UI User Interface Library
        1. What jQuery UI Is All About
        2. How to Include jQuery UI in Your Pages
        3. Interactions
        4. Using Widgets
        5. Summary
        6. Q&A
        7. Workshop
        8. Exercises
    14. Part VI: Using JavaScript with Other Web Technologies
      1. Hour 22. JavaScript and Multimedia
        1. Multimedia Formats
        2. Browser Plug-Ins
        3. Using an Anchor Tag
        4. Using <embed> and <object>
        5. Flash
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      2. Hour 23. HTML5 and JavaScript
        1. New Markup for HTML5
        2. Some Important New Elements
        3. Drag and Drop
        4. Local Storage
        5. Working with Local Files
        6. Summary
        7. Q&A
        8. Workshop
        9. Exercises
      3. Hour 24. JavaScript Beyond the Web Page
        1. JavaScript Outside the Browser
        2. Writing Google Chrome Extensions
        3. Summary
        4. Q&A
        5. Workshop
        6. Exercises
    15. Part VII: Appendices
      1. Appendix A. Tools for JavaScript Development
        1. Editors
        2. Validators
        3. Debugging and Verifying Tools
      2. Appendix B. JavaScript Quick Reference
    16. Index
    17. Try It Yourself Online!
    18. Add Pages

    Product information

    • Title: Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition
    • Author(s): Phil Ballard, Michael Moncur
    • Release date: November 2012
    • Publisher(s): Sams
    • ISBN: 9780133048322