Due Date: October 25, 2000
This homework has only one question.
(1) Write a simple HTML/Javascript program to allow a user to get the square of a non-negative decimal number. Your HTML should initially display:
User input their decimal numbers in the first text field and results are shown in the second text field.
Your program should provide two ways to get results:
(1) The user hits the return key in the first text
field.
(2) The user clicks the "Get Square!" button.
The "Get Square" button must be a "submit" button.
The following two screens show the actions when correct non-negative decimal numbers are input:
If the input is not a correct non-negative decimal number, an error message is given in the result field. For example:
It is not necessary to worry about the precision of the result (i.e.
computation error in the result field is acceptable.) Furthermore,
if the input field is empty, then the output field should also be empty.