- CSC 363 - JavaScript Functions
- Due Date under Tasks List in Blackboard
- 30 Points
Objectives: The lab gives you practice in using javaScript built-in functions, such as parseFloat, as well as writing your own functions that receive parameters when called.
Implement the following functions:
A. Function Celsius returns the Celsius equivalent of a Fahrenheit temperature, using the calculation:
C = 5.0/9.0 * (F-32)
B. Function Fahrenheit returns the Fahrenheit equivalent of a Celsius temperature, using the calculations:
F = 9.0/5.0*C+32
C. Use these functions to write a script that enables the user to enter either a Fahrenheit or a Celsius temperature and displays the Celsius or Fahrenheit equivalent, respectively.
Your XHTML document should contain three buttons - one to initiate the conversion from Fahrenheit to Celsius and one to initiate the conversion from Celsius to Fahrenheit, and one to clear values of textboxes. Screen Captures of solution web page follow:
|
Page when it first opens. |
|
After entering 0 in the Celsius input box then clicking the Convert to Fahrenheit button |
|
After pressing the Reset Button, both text boxes are cleared. |
|
After entering 212 in the Fahrenheit input box then clicking the Convert to Celsius button. |
|
After pressing the Reset button, then entering 25.4 in the Celsius input box and clicking the Convert to Fahrenheit b
| |