X52.9755 Lecture 9: Thursday, April 16, 1998
In-class examples
- A function with an
argument.
(Last week's
had no argument.)
- Find the x, y
coördinates
of a pixel in an image.
World Wide Web Consortium documentation for
- Image
replacement
in an event handler.
Netscape documentation for
- Cache
the images in memory before you use them.
- Consolidate
similar event handlers into one function.
(Previous
example
of a function with no arguments.)
Netscape documentation for
- Do the same thing with
links
instead of <AREA>'s.
- Do something
once
in the future.
Netscape documentation for
- Do something
over and over
in the future.
- How much longer
do we have to sit here?
- 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.
- In
Handout 8,
we put event handlers in a form.
In
Handout 9,
the event handlers are consolidated into a function.
- Do
arithmetic
in the event handlers.
- Handle individual
keystrokes.
Netscape documentation for
- Open
a new window.
Netscape documentation for