Lesson 5 Objects, events, buttons, mouse-clicks and functions. Random numbers Basic elements, naming, and scope. Random numbers & as boiled to simplicity Another legal consideration -- when is linking allowed? (an extensive bibliography) and Linking rights (by Brad Templeton, this "frames" the issue in a reasonable context.) |
![]() |
![]() |
![]() |
![]() |
Exercise #5.
Create (or modify, with proper citation, borrowings from the public domain) 10 small images (60 x 60 pixels or less). Create a page containing 17 image tags and a button located as shown:
.
The button and the first image should appear next to each other near the top of the page; while the remaining 16 image tags should be located (seamlessly) in a table, below the button. When the page loads, the source files associated with the image tags in the table are randomly initialized. When the user clicks the button, three things happen:
1. The source of the first image tag rolls over to another image, with its source being chosen randomly with equal probability from among the 10 images you've created.
2. A random position within the table is chosen and its source file is replaced by a "blank" image.(Just one is changed; the others remain the same.)
3. If all sixteen images displayed in the table are the same (i.e., when they all finally become blank), an alert box pops up.