Temperature Converter Solution

Create a file called tempconv.html
Have a text box that you enter your temperature into
Instead of a textbox to write the answer, use a div and getElementById and innerHTML
Have a button that converts from C to F
Have another button that converts from F to C
Use 2 separate functions
make sure ALL your javascript code is up in the head
Set up an event for the button (Links to an external site.) to do the calculations
The two functions needed are below:


function convertToC(F)
{
var result = (temp -32) * (5/9);
return result;
}

var c = convertToC(78);


function convertToF(C)
{
var result = (temp * (9/5)) + 32;
return result;
}

var f = convertToF(25);
Powered by