# Convertir de Celsius a Fahrenheit Online

Debido a que estuve bastantes visitas en mi versión wxWidgets del conversor de Celsius a Fahrenheit, decidí preparar una versión online que permita realizar fácilmente la conversión.

 Celsius: Fahrenheit:

Convert Celsius to Fahrenheit Online está liberado bajo la licencia GNU GPL v3

Acá está el código fuente completo:

<script type="text/javascript">
// *****************************************************************************
// Description: Convertir de Celsius a Fahrenheit Online by NeoEGM
// Author: Ezequiel Miravalles
// Last modification: 16/08/2009
// URL: http://www.neoegm.com/es/tech/online-tools/convert-celsius-to-fahrenheit-online/
// *****************************************************************************

/*******************************************************************************
Copyright (C) 2009 Ezequiel Gastón Miravalles

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

function isNumber(x)
{
return ( (typeof x === typeof 1) && (null !== x) && isFinite(x) );	//From http://snippets.dzone.com/posts/show/6937
}

function Round(number, digits)
{
return Math.round(number * Math.pow(10,digits)) / Math.pow(10, digits);
}

function CelsiusToFahrenheit(celsius, fahrenheit)
{
var num = celsius.value;

if (num == "" || !isNumber(Number(num)))
else
fahrenheit.value=Round((9/5)*num+32, 2);
}

function FahrenheitToCelsius(fahrenheit, celsius)
{
var num = fahrenheit.value;

if (num == "" || !isNumber(Number(num)))
else
celsius.value=Round((5/9)*(num-32), 2);
}
</script>

<table>
<tr>
<td>Celsius:</td>
<td><input type="text" name="celsius_field" id="celsius_field" style="width:100px" /></td>
<td><input type="button" value="A Fahrenheit" onclick="CelsiusToFahrenheit(\$('celsius_field'), \$('fahrenheit_field'))" /></td>
</tr>
<tr>
<td>Fahrenheit:</td>
<td><input type="text" name="fahrenheit_field" id="fahrenheit_field" style="width:100px" /></td>
<td><input type="button" value="A Celsius" onclick="FahrenheitToCelsius(\$('fahrenheit_field'), \$('celsius_field'))" /></td>
</tr>
</table>

### Support appreciated!

All the content offered in this website is, except noted otherwise, of free nature. This means you can share it wherever you want if you do it freely and stating its source.

If it was useful for you and you’d like to contribute, you can make a donation or, at least, visit one of our advertisers of your choice; they are all around the site.