X52.9755 Lecture 9: Thursday, April 16, 1998

In-class examples

  1. A function with an argument. (Last week's had no argument.)
  2. Find the x, y coördinates of a pixel in an image. World Wide Web Consortium documentation for
  3. Image replacement in an event handler. Netscape documentation for
  4. Cache the images in memory before you use them.
  5. Consolidate similar event handlers into one function. (Previous example of a function with no arguments.) Netscape documentation for
  6. Do the same thing with links instead of <AREA>'s.
  7. Do something once in the future. Netscape documentation for
  8. Do something over and over in the future.
  9. How much longer do we have to sit here?
  10. Cycle the background color. If you add 5 * pi / 6 to the value of sin, the sum is positive for 2/3 of the interval from 0 to 2 * pi.
  11. In Handout 8, we put event handlers in a form. In Handout 9, the event handlers are consolidated into a function.
  12. Do arithmetic in the event handlers.
  13. Handle individual keystrokes. Netscape documentation for
  14. Open a new window. Netscape documentation for