O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Visual QuickStart Guide: JavaScript, Ninth Edition

Book Description

With the proliferation of new, standards-compliant browsers, virtually all users and Web sites can successfully use the latest JavaScript techniques.  This task-based, visual-reference guide has been fully revised and uses step-by-step instructions and plenty of screenshots to give beginning and intermediate scripters what they need to know to keep their skills up-to-date. Readers can start from the beginning to get a tour of the programming language, or look up specific tasks to learn just what they need to know. In this updated ninth edition, readers will find new information on scripting for mobile devices and updated code to work with the latest versions of all major browsers. Readers will also find an expanded focus on getting their JavaScript done quickly by using the near-ubiquitous jQuery library.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication
  4. Special Note
  5. Special Thanks to
  6. Contents at a Glance
  7. Table of Contents
  8. Introduction
    1. We wrote this book for you
    2. How to use this book
    3. You say browser, we say kumbaya
    4. Don’t type that code!
    5. Time to get started
  9. 1. Getting Acquainted with JavaScript
    1. What JavaScript Is
    2. JavaScript Isn’t Java
    3. Where JavaScript Came From
    4. What JavaScript Can Do
    5. What JavaScript Can’t Do
    6. JavaScript and More
    7. The Snap-Together Language
    8. Handling Events
    9. Values and Variables
    10. Writing JavaScript-Friendly HTML
    11. What Tools to Use?
  10. 2. Start Me Up!
    1. Where to Put Your Scripts
    2. About Functions
    3. Using External Scripts
    4. Putting Comments in Scripts
    5. Alerting the User
    6. Confirming a User’s Choice
    7. Prompting the User
    8. Redirecting the User with a Link
    9. Using JavaScript to Enhance Links
    10. Using Multi-Level Conditionals
    11. Handling Errors
  11. 3. Your First Web App
    1. Around and Around with Loops
    2. Passing a Value to a Function
    3. Detecting Objects
    4. Working with Arrays
    5. Working with Functions That Return Values
    6. Updating Arrays
    7. Using Do/While Loops
    8. Calling Scripts Multiple Ways
    9. Combining JavaScript and CSS
    10. Checking State
    11. Working with String Arrays
  12. 4. Working with Images
    1. Creating Rollovers
    2. Creating More Effective Rollovers
    3. Building Three-State Rollovers
    4. Triggering Rollovers from a Link
    5. Making Multiple Links Change a Single Rollover
    6. Working with Multiple Rollovers
    7. Creating Cycling Banners
    8. Adding Links to Cycling Banners
    9. Building Wraparound Slideshows
    10. Displaying a Random Image
    11. Cycling Images with a Random Start
  13. 5. Windows and Frames
    1. Keeping a Page out of a Frame
    2. Setting a Target
    3. Loading iframes with JavaScript
    4. Working with iframes
    5. Creating Dynamic iframes
    6. Sharing Functions Between Documents
    7. Opening a New Window
    8. Loading Different Contents into a Window
  14. 6. Form Handling
    1. Select-and-Go Navigation
    2. Changing Menus Dynamically
    3. Making Fields Required
    4. Checking Fields Against Each Other
    5. Identifying Problem Fields
    6. Putting Form Validation into Action
    7. Working with Radio Buttons
    8. Setting One Field with Another
    9. Validating Zip Codes
    10. Validating Email Addresses
  15. 7. Forms and Regular Expressions
    1. Validating an Email Address with Regular Expressions
    2. Validating a File Name
    3. Extracting Strings
    4. Formatting Strings
    5. Formatting and Sorting Strings
    6. Formatting and Validating Strings
    7. Replacing Elements Using Regular Expressions
  16. 8. Handling Events
    1. Handling Window Events
    2. Mouse Event Handling
    3. Form Event Handling
    4. Key Event Handling
    5. Advanced Event Handling
  17. 9. JavaScript and Cookies
    1. Baking Your First Cookie
    2. Reading a Cookie
    3. Showing Your Cookies
    4. Using Cookies as Counters
    5. Deleting Cookies
    6. Handling Multiple Cookies
    7. Displaying “New to You” Messages
  18. 10. Objects and the DOM
    1. About Node Manipulation
    2. Adding Nodes
    3. Deleting Nodes
    4. Deleting Specific Nodes
    5. Inserting Nodes
    6. Replacing Nodes
    7. Writing Code with Object Literals
  19. 11. Making Your Pages Dynamic
    1. Putting the Current Date into a Webpage
    2. Working with Days
    3. Customizing a Message for the Time of Day
    4. Displaying Dates by Time Zone
    5. Converting 24-Hour Time to 12-Hour Time
    6. Creating a Countdown
    7. Hiding and Displaying Layers
    8. Moving an Object in the Document
    9. Date Methods
  20. 12. Applied JavaScript
    1. Using Sliding Menus
    2. Adding Pull-Down Menus
    3. Enhancing Pull-Down Menus
    4. A Slideshow with Captions
    5. A Silly Name Generator
    6. A Bar Graph Generator
    7. Style Sheet Switcher
  21. 13. Introducing Ajax
    1. Ajax: Pinning It Down
    2. Reading Server Data
    3. Parsing Server Data
    4. Refreshing Server Data
    5. Getting Data From a Server
    6. Previewing Links with Ajax
    7. Auto-Completing Form Fields
    8. Checking Whether a File Exists
  22. 14. Toolkits, Frameworks, and Libraries
    1. Adding jQuery
    2. Updating a Page with jQuery
    3. Interacting with jQuery
    4. Interacting and Updating
    5. Striping Tables
    6. Sorting Tables
  23. 15. Designing with jQuery
    1. Highlighting New Elements
    2. Creating Accordion Menus
    3. Creating Smarter Dialogs
    4. Auto-Completing Fields
    5. Adding Sortable Tabs
    6. Using Check Boxes as Buttons
    7. Adding a Calendar to Your Page
    8. Using ThemeRoller to Customize Your Look
  24. 16. Building on jQuery
    1. Using jQuery as a Foundation
    2. Dragging and Dropping Elements
    3. Using jQuery with External Data
    4. Using jQuery Plugins
    5. Adding a jQuery Audio Plugin
  25. 17. Scripting Mobile Devices
    1. Changing Your Orientation
    2. Handling Touch Events
    3. Differentiating Devices
    4. Locating Your Device
  26. 18. Bookmarklets
    1. Your First Bookmarklet
    2. Resetting a Webpage’s Background
    3. Changing a Page’s Styles
    4. Word Lookups
    5. Viewing Images
    6. Displaying ISO Latin Characters
    7. Converting RGB Values to Hex
    8. Converting Values
    9. A Bookmarklet Calculator
    10. Shortening URLs
    11. Validating Pages
    12. Mailing Pages
    13. Resizing Pages
  27. A. JavaScript Genealogy and Reference
    1. JavaScript Versions
    2. ECMAScript
    3. The Big Object Table
  28. B. JavaScript Reserved Words
  29. C. Cascading Style Sheets Reference
  30. D. Where to Learn More
    1. Finding Help Online
    2. Offline Resources
    3. Troubleshooting Tips
  31. Index