Assignment 31: A Possible Answer

This:

<:SCRIPT LANGUAGE="javascript">
function figureIt()
{
var cel = document.ftoc.c.value
var nf = 9 / 5
var celnf = cel * nf
var celAnswer = celnf + 32

document.ftoc.f.value = celAnswer
}
<:/SCRIPT>

<:FORM NAME="ftoc">
Celsius:<INPUT TYPE="text" NAME="c">
<:INPUT TYPE="button" Value="Convert" onClick="figureIt()">
Fahrenheit:<:INPUT TYPE="text" NAME="f">
</form>

 

Gives you this:

Celsius: Fahrenheit:
     Notice how each section is inside its own little variable? It's best to do that.

     You're on your own with Fahrenheit to Celsius.

 

Did You Get It?

 

Back to the Index Page