
| <SCRIPT>
function displayTemp(form) {var tempVal, finalC, finalF, finalTemp; // checks to see if
the first TC radio button is checked } // checks to see if the second TC radio button is checked // - meaning convert Celsius to Fahrenheit else { // get the inputted value from yourInput text field tempVal = form.yourInput.value; // formula for converting Celsius from to Fahrenheit finalF = (tempVal * (9 / 5)) + 32; finalTemp =Math.round(finalF) + " degrees Fahrenheit"; } // output the result of the conversion to the result text field form.result.value = finalTemp; } < /SCRIPT> <FORM><INPUT TYPE="text" NAME="yourInput" onChange="displayTemp(this.form);"> the radio buttons act as an array in this case,
with the first radio button being checked, <INPUT
TYPE="radio"
NAME="TC"
onClick="displayTemp(this.form);"
CHECKED>
Fahrenheit |