Question: I keep having problems with my program. I type it in but it is not converting. My instructions are to create a Web page using
I keep having problems with my program. I type it in but it is not converting. My instructions are to create a Web page using JavaScript that converts celcius to farenheit and vice versa. It should reveal content when you hit go or enter or whatever. Also just got instructions that it has to look pretty with colors.
Temperature Converter
Celcius to Fahrenheit:
Fahrenheit to Celcius :
function cToF()
{
var celsius=document.getElementById("cel").value;
var cTemp = celsius;
var cToFahr = cTemp * 9 / 5 + 32;
var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';
document.getElementById("res").innerHTML = message;
}
function fToC()
{
var fahrenheit=document.getElementById("far").value;
var fTemp = fahrenheit;
var fToCel = (fTemp - 32) * 5 / 9;
var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';
document.getElementById("res").innerHTML = message;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
