You are previewing Beginning JavaScript, 5th Edition.
O'Reilly logo
Beginning JavaScript, 5th Edition

Book Description

The bestselling JavaScript guide, updated with current features and best practices

Beginning JavaScript 5th Edition shows you how to work effectively with JavaScript frameworks, functions, and modern browsers, and teaches more effective coding practices using HTML5. This new edition has been extensively updated to reflect the way JavaScript is most commonly used today, introducing you to the latest tools and techniques available to JavaScript developers. Coverage includes modern coding practices using HTML5 markup, the JSON data format, DOM APIs, the jQuery framework, and more. Exercises with solutions provide plenty of opportunity to practice, and the companion website offers downloadable code for all examples given in the book.

  • Learn JavaScript using the most up to date coding style

  • Understand JSON, functions, events, and feature detection

  • Utilize the new HTML5 elements and the related API

  • Explore new features including geolocation, local storage, and more

  • JavaScript has shaped the Web from a passive medium into one that is rich, dynamic, and interactive. No matter the technology on the server side, it's JavaScript that makes it come alive in the browser. To learn JavaScript the way it's used today, Beginning JavaScript, 5th Edition is your concise guide.

    Table of Contents

    1. INTRODUCTION
      1. WHO THIS BOOK IS FOR
      2. WHAT THIS BOOK COVERS
      3. WHAT YOU NEED TO USE THIS BOOK
      4. CONVENTIONS
      5. SOURCE CODE
      6. ERRATA
      7. P2P.WROX.COM
    2. CHAPTER 1: INTRODUCTION TO JAVASCRIPT AND THE WEB
      1. INTRODUCTION TO JAVASCRIPT
      2. WHERE DO MY SCRIPTS GO?
      3. YOUR FIRST SIMPLE JAVASCRIPT PROGRAM
      4. WRITING MORE JAVASCRIPT
      5. A BRIEF LOOK AT BROWSERS AND COMPATIBILITY PROBLEMS
      6. SUMMARY
    3. CHAPTER 2: DATA TYPES AND VARIABLES
      1. TYPES OF DATA IN JAVASCRIPT
      2. VARIABLES—STORING DATA IN MEMORY
      3. USING DATA—CALCULATIONS AND BASIC STRING MANIPULATION
      4. DATA TYPE CONVERSION
      5. ARRAYS
      6. SUMMARY
      7. EXERCISES
    4. CHAPTER 3: DECISIONS AND LOOPS
      1. DECISION MAKING—THE IF AND SWITCH STATEMENTS
      2. LOOPING—THE FOR AND WHILE STATEMENTS
      3. SUMMARY
      4. EXERCISES
    5. CHAPTER 4: FUNCTIONS AND SCOPE
      1. CREATING YOUR OWN FUNCTIONS
      2. SCOPE AND LIFETIME
      3. FUNCTIONS AS VALUES
      4. SUMMARY
      5. EXERCISES
    6. CHAPTER 5: JAVASCRIPT—AN OBJECT-BASED LANGUAGE
      1. OBJECT-BASED PROGRAMMING
      2. JAVASCRIPT’S NATIVE OBJECT TYPES
      3. CREATING YOUR OWN CUSTOM OBJECTS
      4. CREATING NEW TYPES OF OBJECTS (REFERENCE TYPES)
      5. SUMMARY
      6. EXERCISES
    7. CHAPTER 6: STRING MANIPULATION
      1. ADDITIONAL STRING METHODS
      2. REGULAR EXPRESSIONS
      3. THE STRING OBJECT
      4. USING THE REGEXP OBJECT’S CONSTRUCTOR
      5. SUMMARY
      6. EXERCISES
    8. CHAPTER 7: DATE, TIME, AND TIMERS
      1. WORLD TIME
      2. TIMERS IN A WEB PAGE
      3. SUMMARY
      4. EXERCISES
    9. CHAPTER 8: PROGRAMMING THE BROWSER
      1. INTRODUCTION TO THE BROWSER’S OBJECTS
      2. DETERMINING THE USER’S BROWSER
      3. SUMMARY
      4. EXERCISES
    10. CHAPTER 9: DOM SCRIPTING
      1. THE WEB STANDARDS
      2. THE DOCUMENT OBJECT MODEL
      3. MANIPULATING THE DOM
      4. SUMMARY
      5. EXERCISES
    11. CHAPTER 10: EVENTS
      1. TYPES OF EVENTS
      2. CONNECTING CODE TO EVENTS
      3. THE STANDARD EVENT MODEL
      4. EVENT HANDLING IN OLD VERSIONS OF INTERNET EXPLORER
      5. WRITING CROSS-BROWSER CODE
      6. NATIVE DRAG AND DROP
      7. SUMMARY
      8. EXERCISES
    12. CHAPTER 11: HTML FORMS: INTERACTING WITH THE USER
      1. HTML FORMS
      2. TRADITIONAL FORM OBJECT PROPERTIES AND METHODS
      3. HTML5 FORM OBJECT PROPERTIES AND METHODS
      4. SUMMARY
      5. EXERCISES
    13. CHAPTER 12: JSON
      1. XML
      2. JSON
      3. SUMMARY
      4. EXERCISES
    14. CHAPTER 13: DATA STORAGE
      1. BAKING YOUR FIRST COOKIE
      2. CREATING A COOKIE
      3. GETTING A COOKIE’S VALUE
      4. COOKIE LIMITATIONS
      5. COOKIE SECURITY AND IE
      6. WEB STORAGE
      7. SUMMARY
      8. EXERCISES
    15. CHAPTER 14: AJAX
      1. WHAT IS AJAX?
      2. USING THE XMLHTTPREQUEST OBJECT
      3. CREATING A SIMPLE AJAX MODULE
      4. VALIDATING FORM FIELDS WITH AJAX
      5. THINGS TO WATCH OUT FOR
      6. SUMMARY
      7. EXERCISES
    16. CHAPTER 15: HTML5 MEDIA
      1. A PRIMER
      2. SCRIPTING MEDIA
      3. SUMMARY
      4. EXERCISES
    17. CHAPTER 16: JQUERY
      1. GETTING JQUERY
      2. jQUERY’S API
      3. SUMMARY
      4. EXERCISES
    18. CHAPTER 17: OTHER JAVASCRIPT LIBRARIES
      1. DIGGING INTO MODERNIZR
      2. DIVING INTO PROTOTYPE
      3. DELVING INTO MOOTOOLS
      4. SUMMARY
      5. EXERCISES
    19. CHAPTER 18: COMMON MISTAKES, DEBUGGING, AND ERROR HANDLING
      1. D’OH! I CAN’T BELIEVE I JUST DID THAT: SOME COMMON MISTAKES
      2. ERROR HANDLING
      3. DEBUGGING
      4. SUMMARY
      5. EXERCISES
    20. APPENDIX A: ANSWERS TO EXERCISES
      1. CHAPTER 2
      2. CHAPTER 3
      3. CHAPTER 4
      4. CHAPTER 5
      5. CHAPTER 6
      6. CHAPTER 7
      7. CHAPTER 8
      8. CHAPTER 9
      9. CHAPTER 10
      10. CHAPTER 11
      11. CHAPTER 12
      12. CHAPTER 13
      13. CHAPTER 14
      14. CHAPTER 15
      15. CHAPTER 16
      16. CHAPTER 17
      17. CHAPTER 18
    21. APPENDIX B: JAVASCRIPT CORE REFERENCE
      1. BROWSER REFERENCE
      2. RESERVED WORDS
      3. JAVASCRIPT OPERATORS
      4. JAVASCRIPT STATEMENTS
      5. TOP-LEVEL PROPERTIES AND FUNCTIONS
      6. JAVASCRIPT CORE OBJECTS
    22. APPENDIX C: W3C DOM REFERENCE
      1. DOM CORE OBJECTS
      2. HTML DOM OBJECTS
      3. DOM EVENT MODEL AND OBJECTS
      4. MISCELLANEOUS EVENTS
    23. APPENDIX D: LATIN-1 CHARACTER SET
    24. TITLE PAGE
    25. COPYRIGHT
    26. DEDICATION
    27. CREDITS
    28. ABOUT THE AUTHORS
    29. ACKNOWLEDGMENTS
    30. ADVERT
    31. EULA