Chapter 1. the interactive web: Reacting to the Virtual World
Section 1.1. (Online) people have needs
Section 1.2. Like talking to a brick wall... nothing happens
Section 1.3. But JavaScript talks back
Section 1.4. Lights, camera, inter action!
Section 1.5. Use the <script> tag to tell the browser you're writing JavaScript
Section 1.6. Your web browser can handle HTML, CSS, AND JavaScript
Section 1.7. Man's virtual best friend... needs YOUR help
Section 1.8. Making iRock interactive
Section 1.9. Create the iRock web page
Section 1.10. Test drive
Section 1.11. JavaScript events: giving the iRock a voice
Section 1.12. Alerting the user with a function
Section 1.13. Add the iRock greeting
Section 1.14. Now let's make the iRock really interactive
Section 1.15. Interaction is TWO-way communication
Section 1.16. Add a function to get the user's name
Section 1.17. Instant replay: what just happened?
Section 1.18. Test drive iRock 1.0
Chapter 2. storing data: Everything Has Its Place
Section 2.1. Your scripts can store data
Section 2.2. Scripts think in data types
Section 2.3. Constants stay the SAME, variables can CHANGE
Section 2.4. Variables start out without a value
Section 2.5. Initialize a variable with "="
Section 2.6. Constants are resistant to change
Section 2.7. What's in a name?
Section 2.8. Legal and illegal variable and constant names
Section 2.9. Variable names often use CamelCase
Section 2.10. Plan the Duncan's Donuts web page
Section 2.11. A first take at the donut calculations
Section 2.12. Initialize your data...or else
Section 2.13. NaN is NOT a number
Section 2.14. You can add more than numbers
Section 2.15. parseInt() and parseFloat(): converts text to a number
Section 2.16. Why are extra donuts being ordered?
Section 2.17. Duncan discovers donut espionage
Section 2.18. Use getElementById() to grab form data
Section 2.19. Validate the web form's data
Section 2.20. Strive for intuitive user input
Chapter 3. exploring the client: Browser Spelunking
Section 3.1. Clients, servers, and JavaScript
Section 3.2. What can a browser do for you?
Section 3.3. The iRock needs to be more responsive
Section 3.4. Timers connect action to elapsed time
Section 3.5. Breaking down a timer
Section 3.6. Set a timer with setTimeout()
Section 3.7. A closer look: the setTimeout() function
Section 3.8. Multiple size screens, multiple complaints
Section 3.9. Use the document object to get the client window's width
Section 3.10. Use document object properties to set the client window width
Section 3.11. Set the height and width of the iRock image
Section 3.12. The iRock should be sized to the page
Section 3.13. onresize is triggered when the browser's resized
Section 3.14. The onresize event resizes the rock
Section 3.15. Have we met? Recognizing the user
Section 3.16. Every script has a life cycle
Section 3.17. Cookies outlive your script's life cycle
Section 3.18. Cookies have a name and store a value...and can expire
Section 3.19. Your JavaScript can live OUTSIDE your web page
Section 3.20. Greet the user with a cookie
Section 3.21. greetUser() is cookie-powered now
Section 3.22. Don't forget to set the cookie, too
Section 3.23. Cookies affect browser security
Section 3.24. A world without cookies
Section 3.25. Talk to the users... it's better than nothing
Chapter 4. decision making: If There's a Fork in the Road, Take It
Section 4.1. Lucky contestant, come on down!
Section 4.2. "if" this is true... then do something
Section 4.3. An if statement evaluates a condition... and then takes action
Section 4.4. Use if to choose between two things
Section 4.5. You can make multiple decisions with if
Section 4.6. Adding an else to your if statement
Section 4.7. Variables drive the story
Section 4.8. But part of the story is missing
Section 4.9. Compounding your JavaScript efforts
Section 4.10. Tiered decision making with if/else
Section 4.11. An if can go inside another if
Section 4.12. Your functions control your pages
Section 4.13. Pseudocode lets you map out your adventure
Section 4.14. Stick figure inequality
Section 4.15. != Psst, I've got nothing to tell you...
Section 4.16. Crafting decisions with comparison operators
Section 4.17. Comments, placeholders, and documentation
Section 4.18. Comments in JavaScript start with //
Section 4.19. Scope and context: where data lives
Section 4.20. Check your adventure variable score
Section 4.21. Where does my data live?
Section 4.22. Choice of five
Section 4.23. Nesting if/else can get complicated
Section 4.24. Switch statements have multiple cases
Section 4.25. Inside the switch statement
Section 4.26. A switchy stick figure adventure: test-drive
Chapter 5. looping: At the Risk of Repeating Myself
Section 5.1. X marks the spot
Section 5.2. Déjá vu all over again...for loops
Section 5.3. Treasure hunting with a for loop
Section 5.4. Dissect the for loop
Section 5.5. Mandango: a macho movie seat finder
Section 5.6. First check seat availability
Section 5.7. Looping, HTML, and seat availability
Section 5.8. Movie seats as variables
Section 5.9. Arrays collect multiple pieces of data
Section 5.10. Array values are stored with keys
Section 5.11. From JavaScript to HTML
Section 5.12. Visualizing Mandango seats
Section 5.13. Test drive: the solo seat finder
Section 5.14. Too much of a good thing: endless loops
Section 5.15. Loops always need an exit condition (or two!)
Section 5.16. A "break" in the action
Section 5.17. Boolean operator logic uncovered
Section 5.18. Looping for just a "while"...until a condition is met
Section 5.19. Breaking down the while loop
Section 5.20. Use the right loop for the job
Section 5.21. Movie seat data modeling
Section 5.22. An array of an array: two-dimensional arrays
Section 5.23. Two keys to access 2-D array data
Section 5.24. Mandango in 2-D
Section 5.25. An entire theater of manly seats
Chapter 6. functions: Reduce, Reuse, Recycle
Section 6.1. The mother of all problems
Section 6.3. Functions as problem solvers
Section 6.4. The nuts and bolts of a function
Section 6.5. A function you've already met
Section 6.6. Build a better thermostat with more data
Section 6.7. Passing information to functions
Section 6.8. Function arguments as data
Section 6.9. Functions eliminate duplicate code
Section 6.10. Creating a seat setter function
Section 6.12. The setSeat() function makes Mandango even better
Section 6.13. The significance of feedback
Section 6.14. Returning data from functions
Section 6.15. Many happy return values
Section 6.16. Getting the status of a seat
Section 6.17. Showing the seat status
Section 6.18. You can link the function to an image
Section 6.19. Repetitive code is never a good thing
Section 6.20. Separate your functionality from your content
Section 6.21. Functions are just data
Section 6.22. Calling or referencing your functions
Section 6.23. Events, callbacks, and HTML attributes
Section 6.24. Wiring events using function references
Section 6.25. Function literals to the rescue
Section 6.25. Where's the wiring?
Section 6.25. A shell of an HTML page
Chapter 7. forms and validation: Getting the User to Tell All
Section 7.1. The Bannerocity HTML form
Section 7.2. When HTML is not enough
Section 7.3. Accessing form data
Section 7.4. Form field follow a chain of events
Section 7.5. Losing focus with onblur
Section 7.6. You can use an alert box for validation messages
Section 7.7. Validate fields to make sure you have "not nothing"
Section 7.8. Validation without aggravating alert boxes
Section 7.9. A more subtle non-empty validator
Section 7.10. Size matters...
Section 7.11. Validating the length of data
Section 7.12. Validating a ZIP code
Section 7.13. Validating a date
Section 7.14. Regular expressions aren't "regular"
Section 7.15. Regular expressions define patterns to match
Section 7.16. Metacharacters represent more than one literal character
Section 7.17. Drilling into regular expressions: quantifiers
Section 7.18. Validating data with regular expressions
Section 7.19. Matching mins and maxes
Section 7.20. Eliminating three-digit years with this...or that
Section 7.21. Leave nothing to chance
Section 7.22. Can you hear me now? Phone number validation
Section 7.23. You've got mail: validating email
Section 7.24. The exception is the rule
Section 7.25. Matching optional characters from a set
Section 7.26. Constructing an email validator
Chapter 8. wrangling the page: Slicing and Dicing HTML with the DOM
Section 8.1. Functional but clumsy...interface matters
Section 8.2. Describing scenes without alert boxes
Section 8.3. Accessing HTML elements
Section 8.4. Getting in touch with your inner HTML
Section 8.5. Seeing the forest and the trees: the Document Object Model (DOM)
Section 8.6. Your page is a collection of DOM nodes
Section 8.7. Climbing the DOM tree with properties
Section 8.8. Changing node text with the DOM
Section 8.9. Standards compliant adventuring
Section 8.10. Designing better, cleaner options
Section 8.11. Rethinking node text replacement
Section 8.12. Replacing node text with a function
Section 8.13. Dynamic options are a good thing
Section 8.14. Interactive options are even better
Section 8.15. A matter of style: CSS and DOM
Section 8.16. Swapping style classes
Section 8.17. Classy options
Section 8.18. Test drive the stylized adventure options
Section 8.19. Options gone wrong: the empty button
Section 8.20. A la carte style tweaking
Section 8.21. No more bogus options
Section 8.22. More options, more complexity
Section 8.23. Tracking the decision tree
Section 8.24. Turn your decision history into HTML
Section 8.25. Manufacturing HTML code
Section 8.26. Tracing the adventure story
Chapter 9. bringing data to life: Objects as Frankendata
Section 9.1. A JavaScript-powered party
Section 9.2. Data + actions = object
Section 9.3. An object owns its data
Section 9.4. Object member references with a dot
Section 9.5. Custom objects extend JavaScript
Section 9.6. Construct your custom objects
Section 9.7. What's in a constructor?
Section 9.8. Bringing blog objects to life
Section 9.9. The need for sorting
Section 9.10. A JavaScript object for dating
Section 9.11. Calculating time
Section 9.12. Rethinking blog dates
Section 9.13. An object within an object
Section 9.14. Converting objects to text
Section 9.15. Accessing pieces and parts of a date
Section 9.16. Arrays as objects
Section 9.17. Custom sorting an array
Section 9.18. Sorting made simple with function literals
Section 9.19. Searching the blog array
Section 9.20. Searching within strings: indexOf()
Section 9.21. Searching the blog array
Section 9.22. Searching works now, too!
Section 9.23. The Math object is an organizational object
Section 9.24. Generate random numbers with Math.random
Section 9.25. Turn a function into a method
Section 9.26. Unveiling the shiny new blog object
Section 9.27. What do objects really offer YouCube?
Chapter 10. creating custom objects: Having It Your Way with Custom Objects
Section 10.1. Revisiting the YouCube Blog methods
Section 10.2. Method overload
Section 10.3. Classes vs. instances
Section 10.4. Instances are created from classes
Section 10.5. Access an instance's properties with "this"
Section 10.6. Own once, run many: class-owned methods
Section 10.7. Use prototype to work at a class-level
Section 10.8. Classes, prototypes, and YouCube
Section 10.9. Class properties are shared, too
Section 10.10. Creating class properties with prototype
Section 10.11. Signed and delivered
Section 10.12. A date formatting method
Section 10.13. Extending standard objects
Section 10.14. Custom date object = better YouCube
Section 10.15. A class can have its own method
Section 10.16. Examine the sort comparison function
Section 10.17. Calling a class method
Section 10.18. A picture is worth a thousand blog words
Section 10.19. Incorporating images into YouCube
Section 10.20. Adding imagery to YouCube
Section 10.21. An object-powered YouCube
Chapter 11. kill bugs dead: Good Scripts Gone Wrong
Section 11.1. Real-world debugging
Section 11.2. The case of the buggy IQ calculator
Section 11.3. Try different browsers
Section 11.4. Debugging on easy street
Section 11.5. Variables gone wild undefined
Section 11.6. Crunching the intelligence numbers
Section 11.7. The case of the radio call-in bugs
Section 11.8. Opening up the investigation
Section 11.9. A question of syntax validation (Bug #1)
Section 11.10. Careful with those strings
Section 11.11. Quotes, apostrophes, and consistency
Section 11.12. When a quote isn't a quote, use escape characters
Section 11.13. Undefined isn't just for variables (Bug #2)
Section 11.14. Everyone's a winner (Bug #3)
Section 11.15. Alert box debugging
Section 11.16. Watching variables with alert
Section 11.17. Bad logic is legal but buggy
Section 11.18. Everyone's a loser! (Bug #4)
Section 11.19. Overwhelmed by annoying alerts
Section 11.20. Build a custom console for debugging
Section 11.21. The peskiest errors of all: runtime
Section 11.22. The JavaScript bug trifecta
Section 11.23. Comments as temporary code disablers
Section 11.24. The dangers of shadowy variables
Chapter 12. 12 dynamic data: Touchy-Feely Web Applications
Section 12.1. Yearning for dynamic data
Section 12.2. A data-driven YouCube
Section 12.3. Ajax is all about communitcation
Section 12.4. XML lets you tag YOUR data YOUR way
Section 12.5. XML + HTML = XHTML
Section 12.6. XML and the YouCube blog data
Section 12.7. Injecting YouCube with Ajax
Section 12.8. JavaScript to the Ajax rescue: XMLHttpRequest
Section 12.9. Get or Post? A request with XMLHttpRequest
Section 12.10. Making sense of an Ajax request
Section 12.11. Interactive pages start with a request object
Section 12.12. Call me when you're done
Section 12.13. Handling a response...seamlessly
Section 12.14. The DOM to the rescue
Section 12.15. YouCube is driven by its data
Section 12.16. Dysfunctional buttons
Section 12.17. The buttons need data
Section 12.18. Time-saving web-based blog additions
Section 12.19. Writing blog data
Section 12.20. PHP has needs, too
Section 12.21. Feeding data to the PHP script
Section 12.22. Getting it up: Posting blog data to the server
Section 12.23. Making YouCube more, uh, usable
Section 12.24. Auto-fill fields for your users
Section 12.25. Repetitive task? How about a function?
|