In a file named
winningpercent.html, create a nicely
formatted (using a borderless table) form for the user to enter
- a team's name,
- the number of games the team has played, and
- the number of wins the team has.
When they click on a
"calculate winning percentage" button, the teams
winning percentage (numberWins / numberGames) should be displayed in a multi-line
text area (using the team's name and proper English). The form should then
have the
focus put on the team name entry field, and that field should
be
selected (so the user can just start typing a new team name). There
should be a reset button, and a (normal) button to erase the multi-line textarea.
The message displayed should be something like:
The Minnesota Vikings have played 8
games and have won 2 of them,
so their winning percentage is 0.25
If you need help deciding how to start:
- Use Frontpage to create the form. You'll have to name your form, and
all of the text entry and text display fields.
- Your erase button should just set the value of your multi-line textarea
to the empty String, namely "". Test the erase button before moving
on.
The function you define for the onClick attribute of your calculate
button should:
- Save the number of games and the number of wins in variables. Both
of these variables will need to be parsed as floats.
- Use another variable to hold the value of the teams winning percentage.
- Save the team name in a variable.
- Output the message by setting the value of your textarea to be a String
constructed from words and the variables you've defined.
- Set the focus to the team name text box, and select the text in that
box.