Return to the Javascript Playground |
Download This Page |
There are 52 possible answers stored in an array. When a question is entered, a check is made to see if the question text box has something in it (if not, an alert is put up). A "random" number between 0 and 51 is calculated from the time the question was posed. This number is used to select the answer. The answer is written to the other text box.
See another implementation of this script.
©Lewis A. Shadoff, 1998