Script Categories

Equivalents >>> Temperature 2.

Another way to use JavaScript to find temperature equivalents.

Fahrenheit Celsius

Is Equal to:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
function displayTemp(){
if (document.Zero.elements[1].checked){
var tempVal = document.Zero.yourInput.value
var finalC = (tempVal-32)*5/9
var finalTemp = Math.round(finalC) + " degrees Celcius"
if (document.Zero.elements[2].checked){
var tempVal = document.Zero.yourInput.value
var finalF = (tempVal*9/5)+32
var finalTemp = Math.round(finalF) + " degrees Fahrenheit"
document.buttons.result.value = finalTemp;
<FORM name="Zero" id="Zero">
TYPE="text" name="yourInput" size=8 value="" onChange="displayTemp();">
TYPE="radio" Name="F" Size=1 onclick="displayTemp();">Fahrenheit
<INPUT TYPE="radio" Name="F" Size=1 onclick="displayTemp();">Celsius
<FORM name=buttons>
Is Equal to:
<INPUT TYPE="text" Name="result" Size=30 Value="">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).